of C++ yet.
TEMPLATE = app
-XMINIMAL_FMTS = magproto.cc gpx.cc geo.cc mapsend.cc mapsource.cc garmin.cc \
+MINIMAL_FMTS = magproto.cc explorist_ini.cc gpx.cc geo.cc mapsend.cc mapsource.cc garmin.cc \
garmin_device_xml.cc garmin_tables.cc internal_styles.cc nmea.cc \
kml.cc wbt-200.cc
-XALL_FMTS=$$MINIMAL_FMTS gtm.cc gpsutil.cc pcx.cc cetus.cc copilot.cc \
+ALL_FMTS=$$MINIMAL_FMTS gtm.cc gpsutil.cc pcx.cc cetus.cc copilot.cc \
gpspilot.cc magnav.cc skytraq.cc \
psp.cc holux.cc tmpro.cc tpg.cc tpo.cc \
xcsv.cc gcdb.cc tiger.cc easygps.cc quovadis.cc \
pocketfms_bc.cc pocketfms_fp.cc pocketfms_wp.cc naviguide.cc enigma.cc \
vpl.cc teletype.cc jogmap.cc bushnell.cc bushnell_trl.cc wintec_tes.cc \
subrip.cc garmin_xt.cc explorist_ini.cc \
+
ALL_FMTS=$$MINIMAL_FMTS
FILTERS=position.cc radius.cc duplicate.cc arcdist.cc polygon.cc smplrout.cc \
reverse_route.cc sort.cc stackfilter.cc trackfilter.cc discard.cc \
INCLUDEPATH += jeeps
LIBS += -lexpat
}
+
win32 {
SOURCES += gbser_win32.cc jeeps/gpsusbwin.c
}
mac/libusb/descriptors.c \
mac/libusb/error.c \
mac/libusb/usb.c
-
}
SOURCES += $$ALL_FMTS $$FILTERS $$SUPPORT $$SHAPE $$ZLIB $$JEEPS
/**************************************************************************/
-static gbfile *fin = NULL, *fout = NULL;
+static gbfile* fin = NULL, *fout = NULL;
struct wprdata WPR;
struct trldata TRL;
};
/**************************************************************************/
-
+// FIXME: Why is this code doing its own byte order conversion?
static unsigned int byte_order(void)
{
unsigned long test = BYTEORDER_TEST;
- unsigned char *ptr;
+ unsigned char* ptr;
unsigned int order;
- ptr = (unsigned char *)(&test);
+ ptr = (unsigned char*)(&test);
order = (ptr[0] << 12) | (ptr[1] << 8) | (ptr[2] << 4) | ptr[3];
return order;
}
-static void sw_bytes(void *word)
+static void sw_bytes(void* word)
{
- gbuint8 *p = word;
- gbuint16 *r = word;
+ gbuint8* p = (gbuint8*) word;
+ gbuint16* r = (gbuint16*) word;
*r = (gbuint16)(p[1] << 8 | p[0]);
}
-static void sw_words(void *dword)
+static void sw_words(void* dword)
{
- gbuint16 *p = dword;
- gbuint32 *r = dword;
+ gbuint16* p = (gbuint16*) dword;
+ gbuint32* r = (gbuint32*) dword;
*r = (gbuint32)(p[0] << 16 | p[1]);
}
-static void rev_bytes(void *dword)
+static void rev_bytes(void* dword)
{
- gbuint8 *p = dword;
- gbuint32 *r = dword;
+ gbuint8* p = (gbuint8*) dword;
+ gbuint32* r = (gbuint32*) dword;
*r = (gbuint32)(p[3] << 24 | p[2] << 16 | p[1] << 8 | p[0]);
}
-static void swap_wpthdr(struct wpthdr *wpthdr,
- void (*swap16_func)(void *), void (*swap32_func)(void *))
+static void swap_wpthdr(struct wpthdr* wpthdr,
+ void (*swap16_func)(void*), void (*swap32_func)(void*))
{
int i;
}
}
-static void swap_wpt(struct wpt *wpt,
- void (*swap16_func)(void *), void (*swap32_func)(void *))
+static void swap_wpt(struct wpt* wpt,
+ void (*swap16_func)(void*), void (*swap32_func)(void*))
{
if (swap16_func != NULL) {
swap16_func(&wpt->usecount);
}
}
-static void swap_rtehdr(struct rtehdr *rtehdr,
- void (*swap16_func)(void *), void (*swap32_func)(void *))
+static void swap_rtehdr(struct rtehdr* rtehdr,
+ void (*swap16_func)(void*), void (*swap32_func)(void*))
{
int i;
}
}
-static void swap_rte(struct rte *rte,
- void (*swap16_func)(void *), void (*swap32_func)(void *))
+static void swap_rte(struct rte* rte,
+ void (*swap16_func)(void*), void (*swap32_func)(void*))
{
int i;
}
}
-static void wpr_swap(struct wprdata *wprdata)
+static void wpr_swap(struct wprdata* wprdata)
{
- void (*swap16_func)(void *);
- void (*swap32_func)(void *);
+ void (*swap16_func)(void*);
+ void (*swap32_func)(void*);
int i;
switch (byte_order()) {
}
}
-static void swap_trkhdr(struct trkhdr *trkhdr,
- void (*swap16_func)(void *), void (*swap32_func)(void *))
+static void swap_trkhdr(struct trkhdr* trkhdr,
+ void (*swap16_func)(void*), void (*swap32_func)(void*))
{
if (swap16_func != NULL) {
swap16_func(&(trkhdr->totalpt));
}
}
-static void swap_loghdr(struct loghdr *loghdr,
- void (*swap16_func)(void *), void (*swap32_func)(void *))
+static void swap_loghdr(struct loghdr* loghdr,
+ void (*swap16_func)(void*), void (*swap32_func)(void*))
{
int i;
}
}
-static void swap_trklog(struct trklog *trklog,
- void (*swap16_func)(void *), void (*swap32_func)(void *))
+static void swap_trklog(struct trklog* trklog,
+ void (*swap16_func)(void*), void (*swap32_func)(void*))
{
int i;
}
}
-static void trl_swap(struct trldata *trldata)
+static void trl_swap(struct trldata* trldata)
{
- void (*swap16_func)(void *);
- void (*swap32_func)(void *);
+ void (*swap16_func)(void*);
+ void (*swap32_func)(void*);
int i;
switch (byte_order()) {
/**************************************************************************/
-static void str2lab(char *dest, char *src, int len, char *fmt, int n)
+static void str2lab(char* dest, char* src, int len, char* fmt, int n)
{
int i,j;
}
}
-static void pack_time(time_t t, gbint32 *date, gbint32 *time)
+static void pack_time(time_t t, gbint32* date, gbint32* time)
{
- struct tm *tm;
+ struct tm* tm;
tm = gmtime(&t);
*date = tm->tm_mday | ((tm->tm_mon+1)<<8) | ((tm->tm_year+1900)<<16);
/**************************************************************************/
-static waypoint * get_wpt(struct wprdata *wprdata, unsigned n)
+static waypoint* get_wpt(struct wprdata* wprdata, unsigned n)
{
- struct wpthdr *wpthdr;
- struct wpt *wpt;
+ struct wpthdr* wpthdr;
+ struct wpt* wpt;
int j, idx;
- waypoint *WP;
+ waypoint* WP;
wpthdr = &(wprdata->wpthdr);
idx = wpthdr->idx[n];
static void wpr_read(void)
{
struct wprdata wprdata;
- struct rtehdr *rtehdr;
- struct rte *rte;
+ struct rtehdr* rtehdr;
+ struct rte* rte;
int i, j, idx;
- waypoint *WP;
- route_head *RT;
+ waypoint* WP;
+ route_head* RT;
if (gbfread(&wprdata, sizeof(struct wprdata), 1, fin) != 1) {
fatal(MYNAME ": Read error on %s\n", fin->name);
static void trl_read(void)
{
struct trldata trldata;
- struct trkhdr *trkhdr;
- struct trklog *trklog;
- waypoint *WP;
- route_head *TL;
+ struct trkhdr* trkhdr;
+ struct trklog* trklog;
+ waypoint* WP;
+ route_head* TL;
int i, j;
for (i=0; i<MAXTRK; i+=2) {
/**************************************************************************/
-static int find_wpt(struct wprdata *wprdata, const waypoint *WP)
+static int find_wpt(struct wprdata* wprdata, const waypoint* WP)
{
struct wpt pattern, *wpt;
int i, wpt_idx;
return -1;
}
-static int add_wpt(struct wprdata *wprdata, const waypoint *WP,int isroute)
+static int add_wpt(struct wprdata* wprdata, const waypoint* WP,int isroute)
{
- struct wpthdr *wpthdr;
+ struct wpthdr* wpthdr;
int hdr_idx, wpt_idx;
- struct wpt *wpt;
+ struct wpt* wpt;
int i;
wpthdr = &(wprdata->wpthdr);
return hdr_idx;
}
-static void wpr_waypoint(const waypoint *WP)
+static void wpr_waypoint(const waypoint* WP)
{
add_wpt(&WPR, WP, 0);
}
-static void wpr_route_hdr(const route_head *RT)
+static void wpr_route_hdr(const route_head* RT)
{
- struct rtehdr *rtehdr;
+ struct rtehdr* rtehdr;
int hdr_idx, rte_idx;
- struct rte *rte;
+ struct rte* rte;
int i;
rtehdr = &(WPR.rtehdr);
/* rtehdr->rteno = rte_idx; */
}
-static void wpr_route_wpt(const waypoint *WP)
+static void wpr_route_wpt(const waypoint* WP)
{
- struct rte *rte;
+ struct rte* rte;
int wpt_idx;
rte = &(WPR.rte[WPR.rtehdr.num -1]);
rte->wptnum ++;
}
-static void wpr_route_trl(const route_head *RT)
+static void wpr_route_trl(const route_head* RT)
{
/* should we do some final sanity checks? */
}
/**************************************************************************/
-static void trl_track_hdr(const route_head *TL)
+static void trl_track_hdr(const route_head* TL)
{
- struct trkhdr *trkhdr;
+ struct trkhdr* trkhdr;
int idx, l;
trkhdr = TRL.loghdr.trkhdr;
TRL.loghdr.num = idx;
}
-static void trl_track_wpt(const waypoint *WP)
+static void trl_track_wpt(const waypoint* WP)
{
- struct trklog *trklog;
- struct trkhdr *trkhdr;
+ struct trklog* trklog;
+ struct trkhdr* trkhdr;
int trk_idx, log_idx;
trk_idx = TRL.loghdr.num;
trkhdr->next = trkhdr->totalpt;
}
-static void trl_track_tlr(const route_head *TL)
+static void trl_track_tlr(const route_head* TL)
{
- struct trkhdr *trkhdr;
+ struct trkhdr* trkhdr;
int trk_idx;
trk_idx = TRL.loghdr.num;
static void trl_write(void)
{
- struct trkhdr *trkhdr;
- void *buf;
+ struct trkhdr* trkhdr;
+ void* buf;
int i;
size_t fill;
/**************************************************************************/
-static void alan_rd_init(const char *fname)
+static void alan_rd_init(const char* fname)
{
fin = gbfopen(fname, "rb", MYNAME);
}
}
-static void alan_wr_init(const char *fname)
+static void alan_wr_init(const char* fname)
{
fout = gbfopen(fname, "wb", MYNAME);
}
ff_vecs_t alanwpr_vecs = {
ff_type_file,
{
- ff_cap_read | ff_cap_write /* waypoints */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */,
ff_cap_none /* tracks */,
- ff_cap_read | ff_cap_write /* routes */
+ (ff_cap)(ff_cap_read | ff_cap_write) /* routes */
},
alan_rd_init,
alan_wr_init,
ff_type_file,
{
ff_cap_none /* waypoints */,
- ff_cap_read | ff_cap_write /* tracks */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */,
ff_cap_none /* routes */
},
alan_rd_init,
#define MYNAME "an1"
#include "defs.h"
-static gbfile *infile;
-static gbfile *outfile;
-
-static char *output_type = NULL;
-static char *road_changes = NULL;
-static char *nogc = NULL;
-static char *nourl = NULL;
-static char *opt_symbol = NULL;
-static char *opt_color = NULL;
-static char *opt_zoom = NULL;
-static char *opt_wpt_type = NULL;
-static char *opt_radius = NULL;
+static gbfile* infile;
+static gbfile* outfile;
+
+static char* output_type = NULL;
+static char* road_changes = NULL;
+static char* nogc = NULL;
+static char* nourl = NULL;
+static char* opt_symbol = NULL;
+static char* opt_color = NULL;
+static char* opt_zoom = NULL;
+static char* opt_wpt_type = NULL;
+static char* opt_radius = NULL;
static short output_type_num = 0;
static short opt_zoom_num = 0;
typedef struct roadchange {
long type;
- char *name;
+ char* name;
} roadchange;
-roadchange *roadchanges = NULL;
+roadchange* roadchanges = NULL;
static
arglist_t an1_args[] = {
#define ReadDouble(f) gbfgetdbl(f)
#define WriteDouble(f,d) gbfputdbl((d),f)
-static char *
-ReadString(gbfile * f, short len)
+static char*
+ReadString(gbfile* f, short len)
{
- char *result = NULL;
- result = (char *)xcalloc(1, len + 1);
+ char* result = NULL;
+ result = (char*)xcalloc(1, len + 1);
if (len) {
gbfread(result, 1, len, f);
}
#define WriteString(f,s) gbfputs((s),f)
static void
-ReadGuid(gbfile *f, GUID *guid)
+ReadGuid(gbfile* f, GUID* guid)
{
int i = 0;
guid->l = ReadLong(f);
}
static void
-WriteGuid(gbfile *f, GUID *guid)
+WriteGuid(gbfile* f, GUID* guid)
{
int i = 0;
WriteLong(f, guid->l);
}
static void
-Skip(gbfile * f,
+Skip(gbfile* f,
unsigned long distance)
{
gbfseek(f, distance, SEEK_CUR);
long hotspoty;
long unk1;
GUID guid;
- char *name;
+ char* name;
} an1_symbol_record;
typedef struct {
unsigned char visible_zoom;
short unk5;
double radius; /* in km */
- char *name;
- char *fontname;
+ char* name;
+ char* fontname;
GUID guid;
long fontcolor;
long fontstyle;
/* Added in SA2006/Topo 6.0 */
short unk6_1;
- char *url;
- char *comment;
+ char* url;
+ char* comment;
long creation_time;
long modification_time;
- char *image_name;
+ char* image_name;
} an1_waypoint_record;
typedef struct {
short unk3;
short type;
long unk4;
- char *name;
+ char* name;
long lineweight;
long linestyle;
long linecolor;
long pointcount;
} an1_line_record;
-static an1_waypoint_record *Alloc_AN1_Waypoint();
+static an1_waypoint_record* Alloc_AN1_Waypoint();
-void Destroy_AN1_Waypoint(void *vwpt)
+void Destroy_AN1_Waypoint(void* vwpt)
{
- an1_waypoint_record *wpt = (an1_waypoint_record *)vwpt;
+ an1_waypoint_record* wpt = (an1_waypoint_record*)vwpt;
xfree(wpt->name);
xfree(wpt->fontname);
if (wpt->url) {
xfree(vwpt);
}
-void Copy_AN1_Waypoint(void **vdwpt, void *vwpt)
+void Copy_AN1_Waypoint(void** vdwpt, void* vwpt)
{
- an1_waypoint_record *wpt = (an1_waypoint_record *)vwpt;
- an1_waypoint_record *dwpt = Alloc_AN1_Waypoint();
+ an1_waypoint_record* wpt = (an1_waypoint_record*)vwpt;
+ an1_waypoint_record* dwpt = Alloc_AN1_Waypoint();
memcpy(dwpt, wpt, sizeof(an1_waypoint_record));
dwpt->name = xstrdup(wpt->name);
dwpt->fontname = xstrdup(wpt->fontname);
dwpt->url = xstrdup(wpt->url);
dwpt->comment = xstrdup(wpt->comment);
dwpt->image_name = xstrdup(wpt->image_name);
- *vdwpt = (void *)dwpt;
+ *vdwpt = (void*)dwpt;
}
-static an1_waypoint_record *Alloc_AN1_Waypoint()
+static an1_waypoint_record* Alloc_AN1_Waypoint()
{
- an1_waypoint_record *result = NULL;
- result = (an1_waypoint_record *)xcalloc(sizeof(*result), 1);
+ an1_waypoint_record* result = NULL;
+ result = (an1_waypoint_record*)xcalloc(sizeof(*result), 1);
result->fs.type = FS_AN1W;
result->fs.copy = Copy_AN1_Waypoint;
result->fs.destroy = Destroy_AN1_Waypoint;
return result;
}
-static an1_vertex_record *Alloc_AN1_Vertex();
+static an1_vertex_record* Alloc_AN1_Vertex();
-void Destroy_AN1_Vertex(void *vvertex)
+void Destroy_AN1_Vertex(void* vvertex)
{
xfree(vvertex);
}
-void Copy_AN1_Vertex(void **vdvert, void *vvert)
+void Copy_AN1_Vertex(void** vdvert, void* vvert)
{
- an1_vertex_record *vert = (an1_vertex_record *)vvert;
- an1_vertex_record *dvert = Alloc_AN1_Vertex();
+ an1_vertex_record* vert = (an1_vertex_record*)vvert;
+ an1_vertex_record* dvert = Alloc_AN1_Vertex();
memcpy(dvert, vert, sizeof(an1_vertex_record));
- *vdvert = (void *)dvert;
+ *vdvert = (void*)dvert;
}
-static an1_vertex_record *Alloc_AN1_Vertex()
+static an1_vertex_record* Alloc_AN1_Vertex()
{
- an1_vertex_record *result = NULL;
- result = (an1_vertex_record *)xcalloc(sizeof(*result), 1);
+ an1_vertex_record* result = NULL;
+ result = (an1_vertex_record*)xcalloc(sizeof(*result), 1);
result->fs.type = FS_AN1V;
result->fs.copy = Copy_AN1_Vertex;
result->fs.destroy = Destroy_AN1_Vertex;
}
-static an1_line_record *Alloc_AN1_Line();
+static an1_line_record* Alloc_AN1_Line();
-void Destroy_AN1_Line(void *vline)
+void Destroy_AN1_Line(void* vline)
{
- an1_line_record *line = (an1_line_record *)vline;
+ an1_line_record* line = (an1_line_record*)vline;
xfree(line->name);
xfree(vline);
}
-void Copy_AN1_Line(void **vdline, void *vline)
+void Copy_AN1_Line(void** vdline, void* vline)
{
- an1_line_record *line = (an1_line_record *)vline;
- an1_line_record *dline = Alloc_AN1_Line();
+ an1_line_record* line = (an1_line_record*)vline;
+ an1_line_record* dline = Alloc_AN1_Line();
memcpy(dline, line, sizeof(an1_line_record));
dline->name = xstrdup(line->name);
- *vdline = (void *)dline;
+ *vdline = (void*)dline;
}
-static an1_line_record *Alloc_AN1_Line()
+static an1_line_record* Alloc_AN1_Line()
{
- an1_line_record *result = NULL;
- result = (an1_line_record *)xcalloc(sizeof(*result), 1);
+ an1_line_record* result = NULL;
+ result = (an1_line_record*)xcalloc(sizeof(*result), 1);
result->fs.type = FS_AN1L;
result->fs.copy = Copy_AN1_Line;
result->fs.destroy = Destroy_AN1_Line;
}
-static void Destroy_AN1_Symbol(an1_symbol_record *symbol)
+static void Destroy_AN1_Symbol(an1_symbol_record* symbol)
{
xfree(symbol->name);
}
-static void Read_AN1_Waypoint(gbfile *f, an1_waypoint_record *wpt)
+static void Read_AN1_Waypoint(gbfile* f, an1_waypoint_record* wpt)
{
short len;
if (len != strlen(wpt->name)) {
/* This happens in 06/6.0 files that put extra data in the
* name record for backward compatibility's sake */
- char *ofs = wpt->name + strlen(wpt->name) + 1;
+ char* ofs = wpt->name + strlen(wpt->name) + 1;
wpt->unk6_1 = le_read16(ofs);
ofs += 2;
ofs += 2;
if (len) {
- char *oldurlstr;
+ char* oldurlstr;
/*
* Trust URL encoded in new format over one in
* old format if both are present. Whack the
wpt->fillflags = ReadLong(f);
}
-static void Write_AN1_Waypoint(gbfile *f, an1_waypoint_record *wpt)
+static void Write_AN1_Waypoint(gbfile* f, an1_waypoint_record* wpt)
{
short len;
WriteLong(f, wpt->fillflags);
}
-static void Read_AN1_Vertex(gbfile *f, an1_vertex_record *vertex)
+static void Read_AN1_Vertex(gbfile* f, an1_vertex_record* vertex)
{
vertex->magic = ReadShort(f);
vertex->unk1 = ReadShort(f);
}
-static void Write_AN1_Vertex(gbfile *f, an1_vertex_record *vertex)
+static void Write_AN1_Vertex(gbfile* f, an1_vertex_record* vertex)
{
WriteShort(f, vertex->magic);
WriteLong(f, vertex->unk0);
WriteShort(f, vertex->unk1);
}
-static void Read_AN1_Line(gbfile *f, an1_line_record *line)
+static void Read_AN1_Line(gbfile* f, an1_line_record* line)
{
short len;
line->pointcount = ReadLong(f);
}
-static void Write_AN1_Line(gbfile *f, an1_line_record *line)
+static void Write_AN1_Line(gbfile* f, an1_line_record* line)
{
short len;
WriteLong(f, line->pointcount);
}
-static void Skip_AN1_IL(gbfile *f)
+static void Skip_AN1_IL(gbfile* f)
{
Skip(f, 26);
}
-static void Skip_AN1_BM(gbfile *f)
+static void Skip_AN1_BM(gbfile* f)
{
unsigned long bmsize;
unsigned long palettesize;
Skip(f, bmsize + palettesize);
}
-static void Read_AN1_Symbol(gbfile *f, an1_symbol_record *symbol)
+static void Read_AN1_Symbol(gbfile* f, an1_symbol_record* symbol)
{
short len;
symbol->name = ReadString(f, len);
}
-static void Read_AN1_Header(gbfile *f)
+static void Read_AN1_Header(gbfile* f)
{
unsigned short magic;
unsigned short type;
last_read_type = type;
}
-static void Write_AN1_Header(gbfile *f)
+static void Write_AN1_Header(gbfile* f)
{
WriteShort(f, 11557);
WriteShort(f, output_type_num);
}
-static void Read_AN1_Bitmaps(gbfile *f)
+static void Read_AN1_Bitmaps(gbfile* f)
{
long count;
unsigned short magic;
/* Read the symbol table */
}
-static void Write_AN1_Bitmaps(gbfile *f)
+static void Write_AN1_Bitmaps(gbfile* f)
{
/* On write, we don't output any bitmaps, so writing them
* is just a matter of writing a count of zero */
WriteLong(f, 0);
}
-static void Read_AN1_Waypoints(gbfile *f)
+static void Read_AN1_Waypoints(gbfile* f)
{
unsigned long count = 0;
unsigned long i = 0;
- an1_waypoint_record *rec = NULL;
- waypoint *wpt_tmp;
- char *icon = NULL;
- char *url = NULL;
+ an1_waypoint_record* rec = NULL;
+ waypoint* wpt_tmp;
+ char* icon = NULL;
+ char* url = NULL;
ReadShort(f);
count = ReadLong(f);
for (i = 0; i < count; i++) {
wpt_tmp->icon_descr = icon;
}
- fs_chain_add(&(wpt_tmp->fs), (format_specific_data *)rec);
+ fs_chain_add(&(wpt_tmp->fs), (format_specific_data*)rec);
rec = NULL;
waypt_add(wpt_tmp);
}
}
static void
-Write_One_AN1_Waypoint(const waypoint *wpt)
+Write_One_AN1_Waypoint(const waypoint* wpt)
{
- an1_waypoint_record *rec;
+ an1_waypoint_record* rec;
int local;
- format_specific_data *fs = NULL;
+ format_specific_data* fs = NULL;
fs = fs_chain_find(wpt->fs, FS_AN1W);
if (fs) {
- rec = (an1_waypoint_record *)fs;
+ rec = (an1_waypoint_record*)fs;
xfree(rec->name);
local = 0;
if (opt_zoom) {
rec->name = xstrdup(wpt->description);
if (!nogc && wpt->gc_data->id) {
- char *extra = (char *) xmalloc(25 + strlen(wpt->gc_data->placer) + strlen(wpt->shortname));
+ char* extra = (char*) xmalloc(25 + strlen(wpt->gc_data->placer) + strlen(wpt->shortname));
sprintf(extra, "\r\nBy %s\r\n%s (%1.1f/%1.1f)",
wpt->gc_data->placer,
wpt->shortname, wpt->gc_data->diff/10.0,
if (!nourl && wpt->url) {
int len = 7+strlen(wpt->url);
- char *extra = (char *)xmalloc(len);
+ char* extra = (char*)xmalloc(len);
sprintf(extra, "{URL=%s}", wpt->url);
rec->name = xstrappend(rec->name, extra);
xfree(extra);
}
}
if (!rec->image_name && wpt->icon_descr) {
- FindIconByName((char *)(void *)wpt->icon_descr, &rec->guid);
+ FindIconByName((char*)(void*)wpt->icon_descr, &rec->guid);
}
Write_AN1_Waypoint(outfile, rec);
}
}
-static void Write_AN1_Waypoints(gbfile *f)
+static void Write_AN1_Waypoints(gbfile* f)
{
WriteShort(f, 2);
WriteLong(f, waypt_count());
waypt_disp_all(Write_One_AN1_Waypoint);
}
-static void Read_AN1_Lines(gbfile *f)
+static void Read_AN1_Lines(gbfile* f)
{
unsigned long count = 0;
unsigned long i = 0;
unsigned long j = 0;
- an1_line_record *rec = NULL;
- an1_vertex_record *vert = NULL;
- route_head *rte_head;
- waypoint *wpt_tmp;
+ an1_line_record* rec = NULL;
+ an1_vertex_record* vert = NULL;
+ route_head* rte_head;
+ waypoint* wpt_tmp;
ReadShort(f);
count = ReadLong(f);
rte_head->line_width = rec->lineweight;
}
rte_head->rte_name = xstrdup(rec->name);
- fs_chain_add(&rte_head->fs, (format_specific_data *)rec);
+ fs_chain_add(&rte_head->fs, (format_specific_data*)rec);
route_add_head(rte_head);
for (j = 0; j < (unsigned) rec->pointcount; j++) {
vert = Alloc_AN1_Vertex();
wpt_tmp = waypt_new();
wpt_tmp->latitude = DecodeOrd(vert->lat);
wpt_tmp->longitude = -DecodeOrd(vert->lon);
- wpt_tmp->shortname = (char *) xmalloc(7);
+ wpt_tmp->shortname = (char*) xmalloc(7);
sprintf(wpt_tmp->shortname, "\\%5.5lx", rtserial++);
fs_chain_add(&wpt_tmp->fs,
- (format_specific_data *)vert);
+ (format_specific_data*)vert);
route_add_wpt(rte_head, wpt_tmp);
}
}
}
static void
-Make_Road_Changes(an1_line_record *rec)
+Make_Road_Changes(an1_line_record* rec)
{
int i = 0;
}
static void
-Write_One_AN1_Line(const route_head *rte)
+Write_One_AN1_Line(const route_head* rte)
{
- an1_line_record *rec;
+ an1_line_record* rec;
int local;
- format_specific_data *fs = NULL;
+ format_specific_data* fs = NULL;
fs = fs_chain_find(rte->fs, FS_AN1L);
if (fs) {
- rec = (an1_line_record *)(void *)fs;
+ rec = (an1_line_record*)(void*)fs;
local = 0;
switch (output_type_num) {
case 1:
}
static void
-Write_One_AN1_Vertex(const waypoint *wpt)
+Write_One_AN1_Vertex(const waypoint* wpt)
{
- an1_vertex_record *rec;
+ an1_vertex_record* rec;
int local;
- format_specific_data *fs = NULL;
+ format_specific_data* fs = NULL;
fs = fs_chain_find(wpt->fs, FS_AN1V);
if (fs) {
- rec = (an1_vertex_record *)(void *)fs;
+ rec = (an1_vertex_record*)(void*)fs;
local = 0;
} else {
rec = Alloc_AN1_Vertex();
}
}
-static void Write_AN1_Lines(gbfile *f)
+static void Write_AN1_Lines(gbfile* f)
{
WriteShort(f, 2);
WriteLong(f, route_count()+track_count());
}
static long
-Parse_Change_Type(char *type)
+Parse_Change_Type(char* type)
{
long retval = 0x11100541;
Init_Road_Changes(void)
{
int count = 0;
- char *strType = NULL;
- char *name = NULL;
- char *bar = NULL;
- char *copy = NULL;
+ char* strType = NULL;
+ char* name = NULL;
+ char* bar = NULL;
+ char* copy = NULL;
Free_Road_Changes();
if (!road_changes || !road_changes[0]) {
fatal(MYNAME ": invalid format for road changes\n");
}
count = 1 + count / 2;
- roadchanges = (roadchange *)xmalloc((count+1) * sizeof(roadchange));
+ roadchanges = (roadchange*)xmalloc((count+1) * sizeof(roadchange));
roadchanges[count].type = 0;
roadchanges[count].name = NULL;
}
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
infile = gbfopen_le(fname, "rb", MYNAME);
}
}
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
outfile = gbfopen_le(fname, "wb", MYNAME);
Init_Output_Type();
struct defguid {
GUID guid;
- const char *name;
+ const char* name;
} default_guids[] = {
{ {0xb610bc70,{0x377e, 0x11d6, 0xaeb3}, {0x00, 0x01, 0x02, 0x31, 0x5f, 0xfd}},
"Hiker"
},
};
-int FindIconByName(const char *name, GUID *guid)
+int FindIconByName(const char* name, GUID* guid)
{
int i = 0;
for (i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++) {
return 0;
}
-int FindIconByGuid(GUID *guid, char **name)
+int FindIconByGuid(GUID* guid, char** name)
{
int i = 0;
for (i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++) {
#define MYNAME "Arc filter"
static double pos_dist;
-static char *distopt = NULL;
-static char *arcfileopt = NULL;
-static char *exclopt = NULL;
-static char *ptsopt = NULL;
+static char* distopt = NULL;
+static char* arcfileopt = NULL;
+static char* exclopt = NULL;
+static char* ptsopt = NULL;
typedef struct {
double distance;
void
arcdist_process(void)
{
- queue * elem, * tmp;
- waypoint * waypointp;
+ queue* elem, * tmp;
+ waypoint* waypointp;
double dist;
- extra_data *ed;
+ extra_data* ed;
double lat1, lon1, lat2, lon2;
int fileline = 0;
- char *line;
- gbfile *file_in;
+ char* line;
+ gbfile* file_in;
file_in = gbfopen(arcfileopt, "r", MYNAME);
lat1 = lon1 = lat2 = lon2 = BADVAL;
while ((line = gbfgetstr(file_in))) {
- char *pound = NULL;
+ char* pound = NULL;
int argsfound = 0;
fileline++;
(ptsopt || (lat1 != BADVAL && lon1 != BADVAL))) {
QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
- waypointp = (waypoint *)elem;
+ waypointp = (waypoint*)elem;
if (waypointp->extra_data) {
- ed = (extra_data *) waypointp->extra_data;
+ ed = (extra_data*) waypointp->extra_data;
} else {
- ed = (extra_data *) xcalloc(1, sizeof(*ed));
+ ed = (extra_data*) xcalloc(1, sizeof(*ed));
ed->distance = BADVAL;
}
if (ed->distance == BADVAL || ed->distance >= pos_dist) {
gbfclose(file_in);
QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
- waypoint *wp = (waypoint *) elem;
- ed = (extra_data *) wp->extra_data;
+ waypoint* wp = (waypoint*) elem;
+ ed = (extra_data*) wp->extra_data;
wp->extra_data = NULL;
if (ed) {
if ((ed->distance >= pos_dist) == (exclopt == NULL)) {
}
void
-arcdist_init(const char *args)
+arcdist_init(const char* args)
{
- char *fm;
+ char* fm;
pos_dist = 0;
#endif
#ifdef MEM_DEBUG
-void avltree_check_handle(const void *tree);
+void avltree_check_handle(const void* tree);
#endif
-static void avltree_node_free(const avltree_t *tree, avlnode_t *node);
-static int avltree_node_height(avlnode_t *node);
-static int avltree_insert_node(avltree_t *tree, avlnode_t **root, const char *key, const void *data);
-static int avltree_delete_node(avltree_t *tree, const char *key, avlnode_t **root, int *changed);
-static avlnode_t *avltree_right_rotation(avlnode_t *A);
-static avlnode_t *avltree_left_rotation(avlnode_t *A);
-static avlnode_t *avltree_left_right_rotation(avlnode_t *A);
-static avlnode_t *avltree_right_left_rotation(avlnode_t *A);
-static avlnode_t *avltree_dupe_node(const avltree_t *tree, const avlnode_t *node);
-static int avltree_strcmpr(const char *s1, const char *s2);
-static int avltree_case_ignore_strcmpr(const char *s1, const char *s2);
-static avlnode_t *avltree_find_next(const avltree_t *tree, avlnode_t *node, const char *key);
-static void avltree_save_key(avltree_t *tree, const char *key);
+static void avltree_node_free(const avltree_t* tree, avlnode_t* node);
+static int avltree_node_height(avlnode_t* node);
+static int avltree_insert_node(avltree_t* tree, avlnode_t** root, const char* key, const void* data);
+static int avltree_delete_node(avltree_t* tree, const char* key, avlnode_t** root, int* changed);
+static avlnode_t* avltree_right_rotation(avlnode_t* A);
+static avlnode_t* avltree_left_rotation(avlnode_t* A);
+static avlnode_t* avltree_left_right_rotation(avlnode_t* A);
+static avlnode_t* avltree_right_left_rotation(avlnode_t* A);
+static avlnode_t* avltree_dupe_node(const avltree_t* tree, const avlnode_t* node);
+static int avltree_strcmpr(const char* s1, const char* s2);
+static int avltree_case_ignore_strcmpr(const char* s1, const char* s2);
+static avlnode_t* avltree_find_next(const avltree_t* tree, avlnode_t* node, const char* key);
+static void avltree_save_key(avltree_t* tree, const char* key);
#ifdef MEM_DEBUG
/* Allocate and initialize an AVL Tree */
-avltree_t *
-avltree_init(const int options, const char *module)
+avltree_t*
+avltree_init(const int options, const char* module)
{
- avltree_t *tree;
+ avltree_t* tree;
if ((module == NULL) || (*module == '\0')) {
fatal(MYNAME ": 'avltree_init' should be called with a valid module name!\n");
/* Delete all items of tree [tree] */
int
-avltree_clear(avltree_t *tree)
+avltree_clear(avltree_t* tree)
{
int res;
/* Destroy an AVL Tree */
void
-avltree_done(avltree_t *tree)
+avltree_done(avltree_t* tree)
{
avltree_clear(tree);
xfree(tree);
/* Get number of items in tree */
int
-avltree_count(const avltree_t *tree)
+avltree_count(const avltree_t* tree)
{
AVLTREE_CHECK_HANDLE(tree);
/* Delete item with key [key] */
int
-avltree_delete(avltree_t *tree, const char *key)
+avltree_delete(avltree_t* tree, const char* key)
{
int changed = 0;
/* Duplicate an existing tree */
-avltree_t *
-avltree_dupe(const avltree_t *tree, const char *module)
+avltree_t*
+avltree_dupe(const avltree_t* tree, const char* module)
{
- avltree_t *dupe;
+ avltree_t* dupe;
AVLTREE_CHECK_HANDLE(tree);
/* Find key [key] in tree */
int
-avltree_find(const avltree_t *tree, const char *key, const void **data)
+avltree_find(const avltree_t* tree, const char* key, const void** data)
{
- avlnode_t *node;
+ avlnode_t* node;
AVLTREE_CHECK_HANDLE(tree);
/* Get the first (the MIN-) entry of the tree */
-const char *
-avltree_first(const avltree_t *tree, const void **data)
+const char*
+avltree_first(const avltree_t* tree, const void** data)
{
- avlnode_t *node;
+ avlnode_t* node;
AVLTREE_CHECK_HANDLE(tree);
while (node->left) {
node = node->left;
}
- avltree_save_key((avltree_t *)tree, node->key);
+ avltree_save_key((avltree_t*)tree, node->key);
if (data) {
(*data) = node->data;
}
/* Get the current height of the tree */
int
-avltree_height(const avltree_t *tree)
+avltree_height(const avltree_t* tree)
{
AVLTREE_CHECK_HANDLE(tree);
/* Insert key [key] and [data] into tree */
int
-avltree_insert(avltree_t *tree, const char *key, const void *data)
+avltree_insert(avltree_t* tree, const char* key, const void* data)
{
int count;
/* Get the next (the entry above [key]) */
-const char *
-avltree_next(const avltree_t *tree, const char *key, const void **data)
+const char*
+avltree_next(const avltree_t* tree, const char* key, const void** data)
{
- avlnode_t *node;
+ avlnode_t* node;
AVLTREE_CHECK_HANDLE(tree);
}
if ((node = avltree_find_next(tree, node, key))) {
- avltree_save_key((avltree_t *)tree, node->key);
+ avltree_save_key((avltree_t*)tree, node->key);
if (data) {
(*data) = node->data;
}
} else {
- avltree_save_key((avltree_t *)tree, NULL);
+ avltree_save_key((avltree_t*)tree, NULL);
}
return tree->key;
#ifdef MEM_DEBUG
void
-avltree_check_handle(const avltree_t *tree)
+avltree_check_handle(const avltree_t* tree)
{
if (! tree) {
fatal(MYNAME ": Invalid (NULL-) pointer!\n");
static void
-avltree_node_free(const avltree_t *tree, avlnode_t *node)
+avltree_node_free(const avltree_t* tree, avlnode_t* node)
{
if ((!(tree->options & AVLTREE_STATIC_KEYS)) && node->key) {
- xfree((char *)node->key);
+ xfree((char*)node->key);
}
if (node->left) {
avltree_node_free(tree, node->left);
static int
-avltree_node_height(avlnode_t *node)
+avltree_node_height(avlnode_t* node)
{
int height = 1;
}
-static avlnode_t *
-avltree_right_rotation(avlnode_t *A)
+static avlnode_t*
+avltree_right_rotation(avlnode_t* A)
{
/*
> A B
> .
> / \
*/
- avlnode_t *B;
+ avlnode_t* B;
B = A->right;
A->right = B->left;
}
-static avlnode_t *
-avltree_left_rotation(avlnode_t *A)
+static avlnode_t*
+avltree_left_rotation(avlnode_t* A)
{
/*
> A B
> .
> / \
*/
- avlnode_t *B;
+ avlnode_t* B;
B = A->left;
A->left = B->right;
}
-static avlnode_t *
-avltree_left_right_rotation(avlnode_t *A)
+static avlnode_t*
+avltree_left_right_rotation(avlnode_t* A)
{
/*
> A C
> \
> C
*/
- avlnode_t *B, *C;
+ avlnode_t* B, *C;
B = A->left;
C = B->right;
}
-static avlnode_t *
-avltree_right_left_rotation(avlnode_t *A)
+static avlnode_t*
+avltree_right_left_rotation(avlnode_t* A)
{
/*
> A C
> /
> C
*/
- avlnode_t *B, *C;
+ avlnode_t* B, *C;
B = A->right;
C = B->left;
static int
-avltree_insert_node(avltree_t *tree, avlnode_t **root, const char *key, const void *data)
+avltree_insert_node(avltree_t* tree, avlnode_t** root, const char* key, const void* data)
{
int changed = 0;
int compare;
- avlnode_t *node = (*root);
+ avlnode_t* node = (*root);
if (node == NULL) {
(*root) = node = (avlnode_t*) xcalloc(1, sizeof(*node));
static int
-avltree_delete_node(avltree_t *tree, const char *key, avlnode_t **root, int *changed)
+avltree_delete_node(avltree_t* tree, const char* key, avlnode_t** root, int* changed)
{
- avlnode_t *node = (*root);
+ avlnode_t* node = (*root);
int deleted = 0;
int compare;
} else {
if (node->left) {
if (node->right) {
- const char *temp_key;
- const void *temp_data;
- avlnode_t *succ = node->right;
+ const char* temp_key;
+ const void* temp_data;
+ avlnode_t* succ = node->right;
while (succ->left) {
succ = succ->left; /* find successor */
}
-static avlnode_t *
-avltree_dupe_node(const avltree_t *tree, const avlnode_t *node)
+static avlnode_t*
+avltree_dupe_node(const avltree_t* tree, const avlnode_t* node)
{
- avlnode_t *res = (avlnode_t*) xcalloc(1, sizeof(*res));
+ avlnode_t* res = (avlnode_t*) xcalloc(1, sizeof(*res));
if (tree->options & AVLTREE_STATIC_KEYS) {
res->key = node->key;
static int
-avltree_strcmpr(const char *s1, const char *s2)
+avltree_strcmpr(const char* s1, const char* s2)
{
return -(strcmp(s1, s2));
}
static int
-avltree_case_ignore_strcmpr(const char *s1, const char *s2)
+avltree_case_ignore_strcmpr(const char* s1, const char* s2)
{
return -(case_ignore_strcmp(s1, s2));
}
-static avlnode_t *
-avltree_find_next(const avltree_t *tree, avlnode_t *node, const char *key)
+static avlnode_t*
+avltree_find_next(const avltree_t* tree, avlnode_t* node, const char* key)
{
- avlnode_t *prev = NULL;
+ avlnode_t* prev = NULL;
if (key == NULL) {
if ((node = tree->root)) {
}
*/
static void
-avltree_save_key(avltree_t *tree, const char *key)
+avltree_save_key(avltree_t* tree, const char* key)
{
if (tree->options & AVLTREE_STATIC_KEYS) {
tree->key = key;
} else {
if (key == NULL) {
if (tree->key_sz) {
- xfree((char *)tree->key);
+ xfree((char*)tree->key);
tree->key_sz = 0;
}
tree->key = NULL;
if (tree->key_sz == 0) {
tree->key = (char*) xmalloc(n8);
} else {
- tree->key = (char *) xrealloc((char *)tree->key, n8);
+ tree->key = (char*) xrealloc((char*)tree->key, n8);
}
tree->key_sz = n8;
}
- strncpy((char *)tree->key, key, n);
+ strncpy((char*)tree->key, key, n);
}
}
}
#include <stdlib.h>
#include <string.h>
-typedef int (*avltree_compare_cb)(const char *, const char *);
+typedef int (*avltree_compare_cb)(const char*, const char*);
typedef struct avltree_s {
#ifdef MEM_DEBUG
const int magic;
#endif
- struct avlnode_s *root;
- const char *module;
+ struct avlnode_s* root;
+ const char* module;
int count; /* number of items in tree */
int options;
- const char *key;
+ const char* key;
int key_sz;
avltree_compare_cb compare;
} avltree_t;
typedef struct avlnode_s {
int balance;
- const char *key;
- const void *data;
- struct avlnode_s *left;
- struct avlnode_s *right;
+ const char* key;
+ const void* data;
+ struct avlnode_s* left;
+ struct avlnode_s* right;
} avlnode_t;
/* options for avltree_init */
#define AVLTREE_PARANOIAC 256 /* STOP on "duplicate key" (insert) or on "not found" (delete) */
/* Allocate and initialize an AVL Tree */
-avltree_t *avltree_init(const int options, const char *module);
+avltree_t* avltree_init(const int options, const char* module);
/* Destroy an AVL Tree */
-void avltree_done(avltree_t *tree);
+void avltree_done(avltree_t* tree);
/* Delete all items of tree [tree]; returns number of deleted items */
-int avltree_clear(avltree_t *tree);
+int avltree_clear(avltree_t* tree);
/* Get number of items in tree */
-int avltree_count(const avltree_t *tree);
+int avltree_count(const avltree_t* tree);
/* Delete item with key [key] */
-int avltree_delete(avltree_t *tree, const char *key);
+int avltree_delete(avltree_t* tree, const char* key);
/* Duplicate an existing tree */
-avltree_t *avltree_dupe(const avltree_t *tree, const char *module);
+avltree_t* avltree_dupe(const avltree_t* tree, const char* module);
/* Find key [key] in tree */
-int avltree_find(const avltree_t *tree, const char *key, const void **data);
+int avltree_find(const avltree_t* tree, const char* key, const void** data);
/* Get the first (the MIN-) entry of the tree */
-const char *avltree_first(const avltree_t *tree, const void **data);
+const char* avltree_first(const avltree_t* tree, const void** data);
/* Get the current height of the tree */
-int avltree_height(const avltree_t *tree);
+int avltree_height(const avltree_t* tree);
/* Insert key [key] and [data] into tree */
-int avltree_insert(avltree_t *tree, const char *key, const void *data);
+int avltree_insert(avltree_t* tree, const char* key, const void* data);
/* Get the next (the entry above [key]) */
-const char *avltree_next(const avltree_t *tree, const char *key, const void **data);
+const char* avltree_next(const avltree_t* tree, const char* key, const void** data);
#endif /* AVLTREE_H_INCLUDED */
#define RECORD_LEN 344
-static gbfile *fin;
+static gbfile* fin;
static
arglist_t axim_gpb_args[] = {
};
static float
-le_read32_float(const void *src)
+le_read32_float(const void* src)
{
float f;
gbint32 i;
}
static void
-decode_buff(const char *buff, route_head *track)
+decode_buff(const char* buff, route_head* track)
{
struct tm tm;
double lat, lon, alt, dir;
float vdop, hdop, pdop, spd, Uf1;
int sats;
- waypoint *wpt;
+ waypoint* wpt;
wpt = waypt_new();
memset(&tm, '\0', sizeof(tm));
- tm.tm_year = le_read16((void *)(buff + 16));
- tm.tm_mon = le_read16((void *)(buff + 18));
- tm.tm_mday = le_read16((void *)(buff + 22));
- tm.tm_hour = le_read16((void *)(buff + 24));
- tm.tm_min = le_read16((void *)(buff + 26));
- tm.tm_sec = le_read16((void *)(buff + 28));
- lat = le_read_double((void *)(buff + 32));
- lon = le_read_double((void *)(buff + 40));
- spd = le_read32_float((void *)(buff + 48));
- dir = le_read32_float((void *)(buff + 52));
-
- alt = le_read32_float((void *)(buff + 64));
- Uf1 = le_read32_float((void *)(buff + 68));
-
- hdop = le_read32_float((void *)(buff + 84));
- vdop = le_read32_float((void *)(buff + 88));
- pdop = le_read32_float((void *)(buff + 92));
- sats = le_read16((void *)(buff + 96));
+ tm.tm_year = le_read16((void*)(buff + 16));
+ tm.tm_mon = le_read16((void*)(buff + 18));
+ tm.tm_mday = le_read16((void*)(buff + 22));
+ tm.tm_hour = le_read16((void*)(buff + 24));
+ tm.tm_min = le_read16((void*)(buff + 26));
+ tm.tm_sec = le_read16((void*)(buff + 28));
+ lat = le_read_double((void*)(buff + 32));
+ lon = le_read_double((void*)(buff + 40));
+ spd = le_read32_float((void*)(buff + 48));
+ dir = le_read32_float((void*)(buff + 52));
+
+ alt = le_read32_float((void*)(buff + 64));
+ Uf1 = le_read32_float((void*)(buff + 68));
+
+ hdop = le_read32_float((void*)(buff + 84));
+ vdop = le_read32_float((void*)(buff + 88));
+ pdop = le_read32_float((void*)(buff + 92));
+ sats = le_read16((void*)(buff + 96));
wpt->latitude = lat;
wpt->longitude = lon;
*******************************************************************************/
static void
-axim_gpb_rd_init(const char *fname)
+axim_gpb_rd_init(const char* fname)
{
fin = gbfopen(fname, "rb", MYNAME);
}
axim_gpb_read(void)
{
char buff[RECORD_LEN];
- route_head *track = NULL;
+ route_head* track = NULL;
size_t bytes;
while ((bytes = gbfread(buff, 1, RECORD_LEN, fin))) {
but this seems to be used by Map&Guide when exporting to XML.
*/
-static gbfile *fout;
-static char *filename;
+static gbfile* fout;
+static char* filename;
static int curr_rte_num, target_rte_num;
static double radius;
-static inifile_t *ini;
+static inifile_t* ini;
/* placeholders for options */
-static char *rtenum_opt;
-static char *rtename_opt;
-static char *radius_opt;
-static char *prefer_shortnames_opt;
+static char* rtenum_opt;
+static char* rtename_opt;
+static char* radius_opt;
+static char* prefer_shortnames_opt;
static
arglist_t bcr_args[] = {
};
typedef struct {
- const char *bcr_name;
- const char *mps_name;
- const char *symbol_DE;
+ const char* bcr_name;
+ const char* mps_name;
+ const char* symbol_DE;
int warned;
} bcr_icon_mapping_t;
};
static void
-bcr_handle_icon_str(const char *str, waypoint *wpt)
+bcr_handle_icon_str(const char* str, waypoint* wpt)
{
- bcr_icon_mapping_t *m;
+ bcr_icon_mapping_t* m;
wpt->icon_descr = BCR_DEF_MPS_ICON;
}
}
-static const char *
-get_bcr_icon_from_icon_descr(const char *icon_descr)
+static const char*
+get_bcr_icon_from_icon_descr(const char* icon_descr)
{
- const char *result = BCR_DEF_ICON;
+ const char* result = BCR_DEF_ICON;
if (icon_descr) {
- bcr_icon_mapping_t *m;
+ bcr_icon_mapping_t* m;
for (m = bcr_icon_mapping; (m->bcr_name); m++) {
if (! m->mps_name) {
}
static void
-bcr_rd_init(const char *fname)
+bcr_rd_init(const char* fname)
{
filename = xstrdup(fname);
ini = inifile_init(fname, MYNAME);
/* ------------------------------------------------------------*/
static void
-bcr_create_waypts_from_route(route_head *route)
+bcr_create_waypts_from_route(route_head* route)
{
- waypoint *wpt;
- queue *elem, *tmp;
+ waypoint* wpt;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&route->waypoint_list, elem, tmp) {
- wpt = waypt_dupe((waypoint *) elem);
+ wpt = waypt_dupe((waypoint*) elem);
waypt_add(wpt);
}
}
static void
-bcr_wgs84_to_mercator(const double lat, const double lon, int *north, int *east)
+bcr_wgs84_to_mercator(const double lat, const double lon, int* north, int* east)
{
double N, E;
}
void
-bcr_mercator_to_wgs84(const int north, const int east, double *lat, double *lon)
+bcr_mercator_to_wgs84(const int north, const int east, double* lat, double* lon)
{
*lat = 2 * (atan(exp(north / radius)) - M_PI / 4) / M_PI * (double)180;
*lon = (double)east * (double)180 / (radius * M_PI);
bcr_data_read(void)
{
int index;
- char *str;
- route_head *route;
+ char* str;
+ route_head* route;
route = route_head_alloc();
for (index = 1; index > 0; index ++) {
char station[32];
- char *str;
+ char* str;
int mlat, mlon; /* mercator data */
- waypoint *wpt;
+ waypoint* wpt;
snprintf(station, sizeof(station), "STATION%d", index);
if (NULL == (str = inifile_readstr(ini, "coordinates", station))) {
bcr_mercator_to_wgs84(mlat, mlon, &wpt->latitude, &wpt->longitude);
if (NULL != (str = inifile_readstr(ini, "client", station))) {
- char *cx;
+ char* cx;
cx = strchr(str, ',');
if (cx == NULL) {
}
if (NULL != (str = inifile_readstr(ini, "description", station))) {
- char *c;
+ char* c;
c = strchr(str, ',');
if (c != NULL) {
/* %%% bcr write support %%% ----------------------------------- */
static void
-bcr_wr_init(const char *fname)
+bcr_wr_init(const char* fname)
{
filename = xstrdup(fname);
fout = gbfopen(fname, "wb", MYNAME);
}
static void
-bcr_route_trailer(const route_head *rte)
+bcr_route_trailer(const route_head* rte)
{
}
static void
-bcr_write_wpt(const waypoint *wpt)
+bcr_write_wpt(const waypoint* wpt)
{
}
-void bcr_write_line(gbfile *fout, const char *key, int *index, const char *value)
+void bcr_write_line(gbfile* fout, const char* key, int* index, const char* value)
{
if (value == NULL) { /* this is mostly used in the world of windows */
/* so we respectfully add a CR/LF on each line */
gbfprintf(fout, "%s\r\n", key);
} else {
- char *tmp;
+ char* tmp;
tmp = (value != NULL) ? xstrdup(value) : xstrdup("");
if (index != NULL) {
}
static void
-bcr_route_header(const route_head *route)
+bcr_route_header(const route_head* route)
{
- queue *elem, *tmp;
- waypoint *wpt;
- char *sout;
+ queue* elem, *tmp;
+ waypoint* wpt;
+ char* sout;
int i, north, east, nmin, nmax, emin, emax;
curr_rte_num++;
i = 0;
QUEUE_FOR_EACH(&route->waypoint_list, elem, tmp) {
- const char *icon;
- waypoint *wpt = (waypoint *) elem;
+ const char* icon;
+ waypoint* wpt = (waypoint*) elem;
i++;
i = 0;
QUEUE_FOR_EACH(&route->waypoint_list, elem, tmp) {
i++;
- wpt = (waypoint *) elem;
+ wpt = (waypoint*) elem;
bcr_wgs84_to_mercator(wpt->latitude, wpt->longitude, &north, &east);
i = 0;
QUEUE_FOR_EACH(&route->waypoint_list, elem, tmp) {
- char *s1, *s2, *sout;
+ char* s1, *s2, *sout;
i++;
- wpt = (waypoint *) elem;
+ wpt = (waypoint*) elem;
s1 = wpt->notes;
if (s1 == NULL) {
s1 = wpt->description;
ff_vecs_t bcr_vecs = {
ff_type_file,
- { ff_cap_none, ff_cap_none, ff_cap_read | ff_cap_write},
+ { ff_cap_none, ff_cap_none, (ff_cap)(ff_cap_read | ff_cap_write)},
bcr_rd_init,
bcr_wr_init,
bcr_rd_deinit,
#include "gbser.h"
#include <errno.h>
-static void *serial_handle;
+static void* serial_handle;
#define MYNAME "BRAUNIGER-IQ"
#define PRESTRKNAME "PRESALTTRK"
static const int reqd_bytes[num_states] = { 6, 1, 2, 2, 25, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1 };
-static void rd_init(const char *fname)
+static void rd_init(const char* fname)
{
if (serial_handle = gbser_init(fname), NULL == serial_handle) {
fatal(MYNAME ": Can't open port '%s'\n", fname);
* Process a data record.
* @return zero when all expected data has been received
*/
-static int process_data(const unsigned char *data)
+static int process_data(const unsigned char* data)
{
static int remaining = 100;
static struct tm tm;
static time_t start, creation;
- static route_head *track;
+ static route_head* track;
static unsigned char interval;
time_t finish;
- waypoint *wpt = NULL;
+ waypoint* wpt = NULL;
int i;
if (global_opts.debug_level >= 3) {
#include "defs.h"
#define MYNAME "Bushnell"
-static gbfile *file_in;
-static char *ofname;
+static gbfile* file_in;
+static char* ofname;
static short_handle mkshort_handle = NULL;
static
typedef struct {
const signed int symbol;
- const char *icon;
+ const char* icon;
} icon_mapping_t;
icon_mapping_t bushnell_icons[] = {
};
static unsigned int
-bushnell_get_icon_from_name(const char *name)
+bushnell_get_icon_from_name(const char* name)
{
- icon_mapping_t *t;
+ icon_mapping_t* t;
for (t = bushnell_icons; t->icon > 0; t++) {
if (0 == case_ignore_strcmp(name, t->icon)) {
return t->symbol;
return 0;
}
-static const char *
+static const char*
bushnell_get_name_from_symbol(signed int s)
{
- icon_mapping_t *t;
+ icon_mapping_t* t;
for (t = bushnell_icons; t->icon > 0; t++) {
if (s == t->symbol) {
return t->icon;
}
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
file_in = gbfopen_le(fname, "rb", MYNAME);
}
}
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
- char *dot, *slash;
+ char* dot, *slash;
static char valid_chars [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789"
".-/\\~@#$%^&*()_+=<>"
"abcdefghijklmnopqrstuvwxyz";
gbint32 lat_tmp,lon_tmp;
unsigned int proximity;
unsigned int icon;
- waypoint *wpt_tmp = waypt_new();
+ waypoint* wpt_tmp = waypt_new();
lat_tmp = gbfgetint32(file_in);
lon_tmp = gbfgetint32(file_in);
}
static void
-bushnell_write_one(const waypoint *wpt)
+bushnell_write_one(const waypoint* wpt)
{
char tbuf[20]; // 19 text bytes + null terminator.
char padding[2] = {0, 0};
- gbfile *file_out;
+ gbfile* file_out;
static int wpt_count;
- char *fname;
- char *ident;
+ char* fname;
+ char* ident;
xasprintf(&fname, "%s-%d.wpt", ofname, wpt_count++);
file_out = gbfopen_le(fname, "wb", MYNAME);
#include "defs.h"
#define MYNAME "Bushnell Trail"
-static gbfile *file_in;
-static gbfile *file_out;
+static gbfile* file_in;
+static gbfile* file_out;
static int trkpt_count;
static route_head* trk_head;
};
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
char h[0x14]; // Believed to be zero terminated.
file_in = gbfopen_le(fname, "rb", MYNAME);
}
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
int i,l = strlen(fname);
char obuf[20] = { 0 } ;
- char *p = obuf;
+ char* p = obuf;
file_out = gbfopen_le(fname, "w", MYNAME);
trkpt_count = 0;
for (i = 0; (i < l) && (i < 20); i++) {
int lat_tmp,lon_tmp;
while (1) {
- waypoint *wpt_tmp;
+ waypoint* wpt_tmp;
lat_tmp = gbfgetint32(file_in);
lon_tmp = gbfgetint32(file_in);
}
static void
-bushnell_write_one(const waypoint *wpt)
+bushnell_write_one(const waypoint* wpt)
{
gbint32 lat = wpt->latitude * 10000000.0;
gbint32 lon = wpt->longitude * 10000000.0;
ff_vecs_t bushnell_trl_vecs = {
ff_type_file,
- { ff_cap_none, ff_cap_read | ff_cap_write, ff_cap_none },
+ { ff_cap_none, (ff_cap)(ff_cap_read | ff_cap_write), ff_cap_none },
rd_init,
wr_init,
rd_deinit,
*/
int
-cet_char_to_ucs4(const char src, const cet_cs_vec_t *vec, int *value)
+cet_char_to_ucs4(const char src, const cet_cs_vec_t* vec, int* value)
{
int trash, c;
- int *dest;
+ int* dest;
c = ((unsigned char)src & 0xFF);
dest = (value != NULL) ? value : &trash;
*/
int
-cet_ucs4_to_utf8(char *dest, size_t dest_size, int value)
+cet_ucs4_to_utf8(char* dest, size_t dest_size, int value)
{
int result;
unsigned char trash[16];
- unsigned char *c;
+ unsigned char* c;
- c = (dest != NULL) ? (unsigned char *) dest : trash;
+ c = (dest != NULL) ? (unsigned char*) dest : trash;
if ((value & 0xffffff80) == 0) { /* <= 7 bits */
if (dest_size < 1) {
* return values: 0 if success, otherwise 1
*/
int
-cet_utf8_to_ucs4(const char *str, int *bytes, int *value)
+cet_utf8_to_ucs4(const char* str, int* bytes, int* value)
{
- unsigned char *cp = (unsigned char *)str;
+ unsigned char* cp = (unsigned char*)str;
if (*cp < 0x80) {
if (bytes != NULL) {
if ((*cp & 0xc0) != 0x80) {
break; /* invalid */
} else if (i == 0) { /* all valid */
- char *c = (char *)str; /* found valid sequence, now storing value */
+ char* c = (char*)str; /* found valid sequence, now storing value */
int res = *c++ & (mask ^ 0xFF);
i = len;
while (i-- > 0) {
* if not possible
*/
short
-cet_ucs4_to_char(const int value, const cet_cs_vec_t *vec)
+cet_ucs4_to_char(const int value, const cet_cs_vec_t* vec)
{
- cet_ucs4_link_t *link;
+ cet_ucs4_link_t* link;
- if ((link = (cet_ucs4_link_t *)vec->ucs4_link)) {
+ if ((link = (cet_ucs4_link_t*)vec->ucs4_link)) {
int i = 0;
int j = vec->ucs4_links - 1; /* validate ucs value against vec */
while (i <= j) {
}
}
- if ((link = (cet_ucs4_link_t *)vec->ucs4_extra)) { /* can be NULL */
+ if ((link = (cet_ucs4_link_t*)vec->ucs4_extra)) { /* can be NULL */
int i = 0;
int j = vec->ucs4_extras - 1;
while (i <= j) {
*/
short
-cet_utf8_to_char(const char *str, const cet_cs_vec_t *vec, /* out */ int *bytes, int *value)
+cet_utf8_to_char(const char* str, const cet_cs_vec_t* vec, /* out */ int* bytes, int* value)
{
int b, v;
* Returns the number of valid (visible) characters.
*/
unsigned int
-cet_utf8_strlen(const char *str)
+cet_utf8_strlen(const char* str)
{
if (str) {
- const char *cin = str;
+ const char* cin = str;
int len = 0;
while (*cin) {
*
* Checks and duplicates an UTF-8 string
*/
-char *
-cet_utf8_strdup(const char *str)
+char*
+cet_utf8_strdup(const char* str)
{
if (str) {
return cet_utf8_strndup(str, strlen(str));
*
* Checks and duplicates an UTF-8 string
*/
-char *
-cet_utf8_strndup(const char *str, const int maxlen)
+char*
+cet_utf8_strndup(const char* str, const int maxlen)
{
if (str) {
- const char *cin = str;
- char *res, *cout;
+ const char* cin = str;
+ char* res, *cout;
int len = 0;
res = cout = xstrdup(cin);
*
* Converts a UTF-8 string to given character set
*/
-char *
-cet_str_utf8_to_any(const char *src, const cet_cs_vec_t *vec)
+char*
+cet_str_utf8_to_any(const char* src, const cet_cs_vec_t* vec)
{
- char *c = (char *)src;
+ char* c = (char*)src;
int len;
- char *res, *dest, *cend;
+ char* res, *dest, *cend;
if (c == NULL) {
return NULL;
}
len = strlen(c);
- res = dest = (char *) xmalloc(len + 1); /* target will become smaller or equal length */
+ res = dest = (char*) xmalloc(len + 1); /* target will become smaller or equal length */
cend = c + len;
*
* Converts a string from given character set to UTF-8
*/
-char *
-cet_str_any_to_utf8(const char *src, const cet_cs_vec_t *vec)
+char*
+cet_str_any_to_utf8(const char* src, const cet_cs_vec_t* vec)
{
int len, value;
- char *result, *cin, *cout;
+ char* result, *cin, *cout;
char temp = CET_NOT_CONVERTABLE_DEFAULT;
- cin = (char *)src;
+ cin = (char*)src;
if (cin == NULL) {
return NULL;
}
len += cet_ucs4_to_utf8(NULL, 6, value);
}
- result = cout = (char *) xmalloc(len + 1);
- cin = (char *)src;
+ result = cout = (char*) xmalloc(len + 1);
+ cin = (char*)src;
while (*cin != '\0') {
if (CET_ERROR == cet_char_to_ucs4(*cin++, vec, &value)) {
*
* Converts an unicode string to UTF-8
*/
-char *
-cet_str_uni_to_utf8(const short *src, const int length)
+char*
+cet_str_uni_to_utf8(const short* src, const int length)
{
int i, len;
- unsigned short *cin;
- char *res, *cout;
+ unsigned short* cin;
+ char* res, *cout;
if (src == NULL) {
return NULL;
len = 0;
i = length;
- cin = (unsigned short *)src;
+ cin = (unsigned short*)src;
while (i-- > 0) {
len += cet_ucs4_to_utf8(NULL, 6, le_read16(cin++));
}
- res = cout = (char *) xmalloc(len + 1);
- cin = (unsigned short *)src;
+ res = cout = (char*) xmalloc(len + 1);
+ cin = (unsigned short*)src;
i = length;
while (i-- > 0) {
*
* Converts a string in given character set to a 'wide string' (unicode)
*/
-short *
-cet_str_any_to_uni(const char *src, const cet_cs_vec_t *vec, int *length)
+short*
+cet_str_any_to_uni(const char* src, const cet_cs_vec_t* vec, int* length)
{
- char *utf8;
+ char* utf8;
int len;
- short *res, *sout;
+ short* res, *sout;
if (! src) {
utf8 = xstrdup("");
}
len = cet_utf8_strlen(utf8);
- res = sout = (short int *) xcalloc(2, len + 1);
+ res = sout = (short int*) xcalloc(2, len + 1);
if (len) {
- char *cin = utf8;
+ char* cin = utf8;
while (*cin) {
int bytes, value;
} cet_ucs4_link_t;
typedef struct cet_cs_vec_s {
- const char *name; /* name of character set */
- const char **alias; /* alias table */
- struct cet_cs_vec_s *fallback; /* fallback character set */
- void *unused;
- const int *ucs4_map; /* char to UCS-4 value table */
+ const char* name; /* name of character set */
+ const char** alias; /* alias table */
+ struct cet_cs_vec_s* fallback; /* fallback character set */
+ void* unused;
+ const int* ucs4_map; /* char to UCS-4 value table */
const int ucs4_offset; /* first non standard character */
const int ucs4_count; /* values in table */
- const cet_ucs4_link_t *ucs4_link; /* UCS-4 to char backward links */
+ const cet_ucs4_link_t* ucs4_link; /* UCS-4 to char backward links */
const int ucs4_links; /* number of links */
- const cet_ucs4_link_t *ucs4_extra; /* Non standard UCS-4 to ... */
+ const cet_ucs4_link_t* ucs4_extra; /* Non standard UCS-4 to ... */
const int ucs4_extras; /* number of extra links */
- struct cet_cs_vec_s *next;
+ struct cet_cs_vec_s* next;
} cet_cs_vec_t;
/* single char/value transmission */
-int cet_utf8_to_ucs4(const char *str, int *bytes, int *value);
-int cet_ucs4_to_utf8(char *dest, size_t dest_size, int value);
+int cet_utf8_to_ucs4(const char* str, int* bytes, int* value);
+int cet_ucs4_to_utf8(char* dest, size_t dest_size, int value);
/* single char/value transmission - vec based */
-int cet_char_to_ucs4(const char src, const cet_cs_vec_t *vec, int *value);
-short cet_utf8_to_char(const char *str, const cet_cs_vec_t *vecint, int *bytes, int *value);
-short cet_ucs4_to_char(const int value, const cet_cs_vec_t *vec);
+int cet_char_to_ucs4(const char src, const cet_cs_vec_t* vec, int* value);
+short cet_utf8_to_char(const char* str, const cet_cs_vec_t* vecint, int* bytes, int* value);
+short cet_ucs4_to_char(const int value, const cet_cs_vec_t* vec);
/* string to string - vector based */
-char *cet_str_utf8_to_any(const char *src, const cet_cs_vec_t *vec);
-char *cet_str_any_to_utf8(const char *src, const cet_cs_vec_t *vec);
+char* cet_str_utf8_to_any(const char* src, const cet_cs_vec_t* vec);
+char* cet_str_any_to_utf8(const char* src, const cet_cs_vec_t* vec);
-char *cet_str_uni_to_utf8(const short *src, const int length);
+char* cet_str_uni_to_utf8(const short* src, const int length);
/* UTF-8 string manipulation functions */
-unsigned int cet_utf8_strlen(const char *str);
-char *cet_utf8_strdup(const char *str);
-char *cet_utf8_strndup(const char *str, const int maxlen);
+unsigned int cet_utf8_strlen(const char* str);
+char* cet_utf8_strdup(const char* str);
+char* cet_utf8_strndup(const char* str, const int maxlen);
/* unicode functions */
-short *cet_str_any_to_uni(const char *src, const cet_cs_vec_t *vec, int *length);
+short* cet_str_any_to_uni(const char* src, const cet_cs_vec_t* vec, int* length);
#endif
#define MYNAME "cet_util"
-static cet_cs_vec_t *cet_cs_vec_root = NULL;
+static cet_cs_vec_t* cet_cs_vec_root = NULL;
typedef struct cet_cs_alias_s {
- char *name;
- cet_cs_vec_t *vec;
+ char* name;
+ cet_cs_vec_t* vec;
} cet_cs_alias_t;
-static cet_cs_alias_t *cet_cs_alias;
+static cet_cs_alias_t* cet_cs_alias;
static int cet_cs_alias_ct = 0;
static int cet_cs_vec_ct = 0;
static int cet_output = 0;
/* %%% short hand strings transmission for main character sets %%% */
-char *
-cet_str_utf8_to_iso8859_1(const char *src)
+char*
+cet_str_utf8_to_iso8859_1(const char* src)
{
return cet_str_utf8_to_any(src, &cet_cs_vec_iso_8859_1);
}
-char *
-cet_str_iso8859_1_to_utf8(const char *src)
+char*
+cet_str_iso8859_1_to_utf8(const char* src)
{
return cet_str_any_to_utf8(src, &cet_cs_vec_iso_8859_1);
}
-char *
-cet_str_utf8_to_iso8859_8(const char *src)
+char*
+cet_str_utf8_to_iso8859_8(const char* src)
{
return cet_str_utf8_to_any(src, &cet_cs_vec_iso_8859_8);
}
-char *
-cet_str_iso8859_8_to_utf8(const char *src)
+char*
+cet_str_iso8859_8_to_utf8(const char* src)
{
return cet_str_any_to_utf8(src, &cet_cs_vec_iso_8859_8);
}
-char *
-cet_str_utf8_to_iso8859_15(const char *src)
+char*
+cet_str_utf8_to_iso8859_15(const char* src)
{
return cet_str_utf8_to_any(src, &cet_cs_vec_iso_8859_15);
}
-char *
-cet_str_iso8859_15_to_utf8(const char *src)
+char*
+cet_str_iso8859_15_to_utf8(const char* src)
{
return cet_str_any_to_utf8(src, &cet_cs_vec_iso_8859_15);
}
-char *
-cet_str_utf8_to_us_ascii(const char *src)
+char*
+cet_str_utf8_to_us_ascii(const char* src)
{
return cet_str_utf8_to_any(src, &cet_cs_vec_ansi_x3_4_1968);
}
-char *
-cet_str_us_ascii_to_utf8(const char *src)
+char*
+cet_str_us_ascii_to_utf8(const char* src)
{
return cet_str_any_to_utf8(src, &cet_cs_vec_ansi_x3_4_1968);
}
-char *
-cet_str_utf8_to_cp1252(const char *src)
+char*
+cet_str_utf8_to_cp1252(const char* src)
{
return cet_str_utf8_to_any(src, &cet_cs_vec_cp1252);
}
-char *
-cet_str_cp1252_to_utf8(const char *src)
+char*
+cet_str_cp1252_to_utf8(const char* src)
{
return cet_str_any_to_utf8(src, &cet_cs_vec_cp1252);
}
-char *
-cet_str_utf8_to_cp1255(const char *src)
+char*
+cet_str_utf8_to_cp1255(const char* src)
{
return cet_str_utf8_to_any(src, &cet_cs_vec_cp1255);
}
-char *
-cet_str_cp1255_to_utf8(const char *src)
+char*
+cet_str_cp1255_to_utf8(const char* src)
{
return cet_str_any_to_utf8(src, &cet_cs_vec_cp1255);
}
-short *
-cet_str_utf8_to_uni(const char *src, int *length)
+short*
+cet_str_utf8_to_uni(const char* src, int* length)
{
return cet_str_any_to_uni(src, &cet_cs_vec_utf8, length);
}
*
*/
#if HAVE_LIBEXPAT
-int XMLCALL cet_lib_expat_UnknownEncodingHandler(void *data, const XML_Char *xml_encoding, XML_Encoding *info)
+int XMLCALL cet_lib_expat_UnknownEncodingHandler(void* data, const XML_Char* xml_encoding, XML_Encoding* info)
{
- cet_cs_vec_t *cs;
+ cet_cs_vec_t* cs;
int i, c, ucs4_def;
- const char *encoding;
+ const char* encoding;
encoding = xml_convert_to_char_string(xml_encoding);
cs = cet_find_cs_by_name(encoding);
#endif
-char *
-cet_str_uni_to_any(const short *src, int length, const cet_cs_vec_t *dest_vec)
+char*
+cet_str_uni_to_any(const short* src, int length, const cet_cs_vec_t* dest_vec)
{
- char *res, *c;
- const cet_cs_vec_t *cs = (dest_vec != NULL) ? dest_vec : &cet_cs_vec_ansi_x3_4_1968;
+ char* res, *c;
+ const cet_cs_vec_t* cs = (dest_vec != NULL) ? dest_vec : &cet_cs_vec_ansi_x3_4_1968;
res = cet_str_uni_to_utf8(src, length);
if (cs != &cet_cs_vec_utf8) {
*
* -->> for use in mkshort */
-char *
-cet_str_any_to_any(const char *src, const cet_cs_vec_t *src_vec, const cet_cs_vec_t *dest_vec)
+char*
+cet_str_any_to_any(const char* src, const cet_cs_vec_t* src_vec, const cet_cs_vec_t* dest_vec)
{
- char *c0, *c1;
- const cet_cs_vec_t *v_in = (src_vec != NULL) ? src_vec : &cet_cs_vec_ansi_x3_4_1968;
- const cet_cs_vec_t *v_out = (dest_vec != NULL) ? dest_vec : &cet_cs_vec_ansi_x3_4_1968;
+ char* c0, *c1;
+ const cet_cs_vec_t* v_in = (src_vec != NULL) ? src_vec : &cet_cs_vec_ansi_x3_4_1968;
+ const cet_cs_vec_t* v_out = (dest_vec != NULL) ? dest_vec : &cet_cs_vec_ansi_x3_4_1968;
if (src == NULL) {
return NULL;
*/
int
-cet_valid_char(const char *src, const cet_cs_vec_t *vec)
+cet_valid_char(const char* src, const cet_cs_vec_t* vec)
{
int value;
- const cet_cs_vec_t *v = (vec != NULL) ? vec : &cet_cs_vec_ansi_x3_4_1968;
+ const cet_cs_vec_t* v = (vec != NULL) ? vec : &cet_cs_vec_ansi_x3_4_1968;
return cet_char_to_ucs4(*src, v, &value);
}
#ifdef DEBUG_MEM
void
-cet_check_cs(cet_cs_vec_t *vec) /* test well sorted link & extra tables */
+cet_check_cs(cet_cs_vec_t* vec) /* test well sorted link & extra tables */
{
- cet_ucs4_link_t *link;
+ cet_ucs4_link_t* link;
- if ((link = (cet_ucs4_link_t *)vec->ucs4_link)) {
+ if ((link = (cet_ucs4_link_t*)vec->ucs4_link)) {
int i, j;
for (i = 0, j = 1; j < vec->ucs4_links; i++, j++) {
}
}
- if ((link = (cet_ucs4_link_t *)vec->ucs4_extra)) {
+ if ((link = (cet_ucs4_link_t*)vec->ucs4_extra)) {
int i, j;
for (i = 0, j = 1; j < vec->ucs4_extras; i++, j++) {
#endif
static signed int
-cet_cs_alias_qsort_cb(const void *a, const void *b)
+cet_cs_alias_qsort_cb(const void* a, const void* b)
{
- const cet_cs_alias_t *va = (const cet_cs_alias_t*) a;
- const cet_cs_alias_t *vb = (const cet_cs_alias_t*) b;
+ const cet_cs_alias_t* va = (const cet_cs_alias_t*) a;
+ const cet_cs_alias_t* vb = (const cet_cs_alias_t*) b;
return case_ignore_strcmp(va->name, vb->name);
}
static signed int
-cet_cs_vec_qsort_cb(const void *a, const void *b)
+cet_cs_vec_qsort_cb(const void* a, const void* b)
{
- const cet_cs_vec_t *va = *(cet_cs_vec_t **)a;
- const cet_cs_vec_t *vb = *(cet_cs_vec_t **)b;
+ const cet_cs_vec_t* va = *(cet_cs_vec_t**)a;
+ const cet_cs_vec_t* vb = *(cet_cs_vec_t**)b;
return case_ignore_strcmp(va->name, vb->name);
}
void
-cet_register_cs(cet_cs_vec_t *vec)
+cet_register_cs(cet_cs_vec_t* vec)
{
if (vec->next == NULL) {
vec->next = cet_cs_vec_root;
/* Dummy vector for our native character set */
-const char *cet_cs_utf8_alias[] = {
+const char* cet_cs_utf8_alias[] = {
"utf8", NULL
};
#endif
if (cet_cs_vec_ct > 0) {
- cet_cs_vec_t *p;
- cet_cs_alias_t *list;
+ cet_cs_vec_t* p;
+ cet_cs_alias_t* list;
c = 0;
/* enumerate count of all names and aliases */
for (p = cet_cs_vec_root; p != NULL; p = p->next) {
c++;
if (p->alias != NULL) {
- char **a = (char **)p->alias;
+ char** a = (char**)p->alias;
while ((*a) != NULL) {
a++;
c++;
i = 0;
for (p = cet_cs_vec_root; p != NULL; p = p->next) {
if (p->alias != NULL) {
- char **a = (char **)p->alias;
+ char** a = (char**)p->alias;
list[i].name = xstrdup(p->name);
list[i].vec = p;
/* install fallback for ascii-like (first 128 ch.) character sets */
for (i = 1250; i <= 1258; i++) {
char name[16];
- cet_cs_vec_t *vec;
+ cet_cs_vec_t* vec;
snprintf(name, sizeof(name), "WIN-CP%d", i);
if ((vec = cet_find_cs_by_name(name))) {
}
for (i = 1; i <= 15; i++) {
char name[16];
- cet_cs_vec_t *vec;
+ cet_cs_vec_t* vec;
snprintf(name, sizeof(name), "ISO-8859-%d", i);
if ((vec = cet_find_cs_by_name(name))) {
#endif
}
-cet_cs_vec_t *
-cet_find_cs_by_name(const char *name)
+cet_cs_vec_t*
+cet_find_cs_by_name(const char* name)
{
int i, j;
while (i <= j) {
int a, x;
- cet_cs_alias_t *n;
+ cet_cs_alias_t* n;
a = (i + j) >> 1;
n = &cet_cs_alias[a];
{
int i;
int j = cet_cs_alias_ct;
- cet_cs_alias_t *p = cet_cs_alias;
+ cet_cs_alias_t* p = cet_cs_alias;
if (p == NULL) {
return;
/* gpsbabel additions */
int
-cet_validate_cs(const char *cs, cet_cs_vec_t **vec, char **cs_name)
+cet_validate_cs(const char* cs, cet_cs_vec_t** vec, char** cs_name)
{
- cet_cs_vec_t *v;
+ cet_cs_vec_t* v;
if ((cs == NULL) || (strlen(cs) == 0)) { /* set default us-ascii */
*vec = &cet_cs_vec_ansi_x3_4_1968;
}
void
-cet_convert_init(const char *cs_name, const int force)
+cet_convert_init(const char* cs_name, const int force)
{
if ((force != 0) || (global_opts.charset == NULL)) {
cet_convert_deinit();
/* -------------------------------------------------------------------- */
static void
-cet_flag_waypt(const waypoint *wpt)
+cet_flag_waypt(const waypoint* wpt)
{
- ((waypoint *)(wpt))->wpt_flags.cet_converted = 1;
+ ((waypoint*)(wpt))->wpt_flags.cet_converted = 1;
}
static void
-cet_flag_route(const route_head *rte)
+cet_flag_route(const route_head* rte)
{
- ((route_head *)(rte))->cet_converted = 1;
+ ((route_head*)(rte))->cet_converted = 1;
}
static void
/* %%% complete data strings transformation %%% */
/* -------------------------------------------------------------------- */
-static char * (*converter)(const char *) = NULL;
+static char* (*converter)(const char*) = NULL;
/* two converters */
-static char *
-cet_convert_to_utf8(const char *str)
+static char*
+cet_convert_to_utf8(const char* str)
{
return cet_str_any_to_utf8(str, global_opts.charset);
}
-static char *
-cet_convert_from_utf8(const char *str)
+static char*
+cet_convert_from_utf8(const char* str)
{
return cet_str_utf8_to_any(str, global_opts.charset);
}
/* cet_convert_string: internal used within cet_convert_strings process */
-char *
-cet_convert_string(char *str)
+char*
+cet_convert_string(char* str)
{
- char *res;
+ char* res;
if (str == NULL) {
return NULL; /* return origin if empty or NULL */
/* cet_convert_waypt: internal used within cet_convert_strings process */
static void
-cet_convert_waypt(const waypoint *wpt)
+cet_convert_waypt(const waypoint* wpt)
{
- waypoint *w = (waypoint *)wpt;
- format_specific_data *fs;
- url_link *url_next;
- geocache_data *gc_data = (geocache_data *)wpt->gc_data;
+ waypoint* w = (waypoint*)wpt;
+ format_specific_data* fs;
+ url_link* url_next;
+ geocache_data* gc_data = (geocache_data*)wpt->gc_data;
if ((cet_output == 0) && (w->wpt_flags.cet_converted != 0)) {
return;
/* cet_convert_route_hdr: internal used within cet_convert_strings process */
static void
-cet_convert_route_hdr(const route_head *route)
+cet_convert_route_hdr(const route_head* route)
{
- route_head *rte = (route_head *)route;
+ route_head* rte = (route_head*)route;
if ((cet_output == 0) && (rte->cet_converted != 0)) {
return;
/* cet_convert_route_tlr: internal used within cet_convert_strings process */
static void
-cet_convert_route_tlr(const route_head *route)
+cet_convert_route_tlr(const route_head* route)
{
}
* !!! One of "source" or "target" must be internal cet_cs_vec_utf8 or NULL !!! */
void
-cet_convert_strings(const cet_cs_vec_t *source, const cet_cs_vec_t *target, const char *format)
+cet_convert_strings(const cet_cs_vec_t* source, const cet_cs_vec_t* target, const char* format)
{
- char *cs_name_from, *cs_name_to;
+ char* cs_name_from, *cs_name_to;
converter = NULL;
cet_output = 1;
converter = cet_convert_from_utf8;
- cs_name_from = (char *)cet_cs_vec_utf8.name;
- cs_name_to = (char *)target->name;
+ cs_name_from = (char*)cet_cs_vec_utf8.name;
+ cs_name_to = (char*)target->name;
} else {
if ((target != NULL) && (target != &cet_cs_vec_utf8)) {
fatal(MYNAME ": Internal error!\n");
cet_output = 0;
converter = cet_convert_to_utf8;
- cs_name_to = (char *)cet_cs_vec_utf8.name;
- cs_name_from = (char *)source->name;
+ cs_name_to = (char*)cet_cs_vec_utf8.name;
+ cs_name_from = (char*)source->name;
}
if (global_opts.debug_level > 0) {
* - Put all character set names and aliases to "FILE" - */
void
-cet_disp_character_set_names(FILE *fout)
+cet_disp_character_set_names(FILE* fout)
{
int i, c, ac;
- cet_cs_vec_t *vec;
- cet_cs_vec_t **list;
+ cet_cs_vec_t* vec;
+ cet_cs_vec_t** list;
if (cet_cs_alias_ct == 0) {
return;
fatal(MYNAME ": internal error \"%s\"!\n", "cet_disp_character_set_names");
}
- list = (cet_cs_vec_t **)xcalloc(c, sizeof(*list));
+ list = (cet_cs_vec_t**)xcalloc(c, sizeof(*list));
i = 0; /* fill the list */
for (vec = cet_cs_vec_root; vec != NULL; vec = vec->next) {
fprintf(fout, "GPSBabel builtin character sets: (-c option)\n");
for (i = 0; i < c; i++) {
- char **a;
+ char** a;
vec = list[i];
fprintf(fout, "\n* %s", vec->name);
- a = (char **)vec->alias;
+ a = (char**)vec->alias;
if (a != NULL) {
int column = 0;
int alias = 0;
*
* - print any special hard-coded characters from inside a module - */
-int cet_gbfprintf(gbfile *stream, const cet_cs_vec_t *src_vec, const char *fmt, ...)
+int cet_gbfprintf(gbfile* stream, const cet_cs_vec_t* src_vec, const char* fmt, ...)
{
int res;
- char *cout;
+ char* cout;
va_list args;
va_start(args, fmt);
if (global_opts.charset != src_vec) {
if (src_vec != &cet_cs_vec_utf8) {
- char *ctemp = cet_str_any_to_utf8(cout, src_vec);
+ char* ctemp = cet_str_any_to_utf8(cout, src_vec);
xfree(cout);
cout = ctemp;
}
if (global_opts.charset != &cet_cs_vec_utf8) {
- char *ctemp = cet_str_utf8_to_any(cout, global_opts.charset);
+ char* ctemp = cet_str_utf8_to_any(cout, global_opts.charset);
xfree(cout);
cout = ctemp;
}
* words in native endianness.
*/
-const char *xml_convert_to_char_string_n(const XML_Char *src, int *n)
+const char* xml_convert_to_char_string_n(const XML_Char* src, int* n)
{
#ifdef XML_UNICODE
- char *utf8;
- char *utf8b;
+ char* utf8;
+ char* utf8b;
int i, j;
/*
* may be UNICODE16 words in native endianness.
*/
-const char *xml_convert_to_char_string(const XML_Char *src)
+const char* xml_convert_to_char_string(const XML_Char* src)
{
#ifdef XML_UNICODE
- char *utf8;
- char *utf8b;
+ char* utf8;
+ char* utf8b;
int i, j;
- const XML_Char *in = src;
+ const XML_Char* in = src;
/* Walk source array until we find source terminator */
i = 0;
}
-void xml_free_converted_string(const char *str)
+void xml_free_converted_string(const char* str)
{
#ifdef XML_UNICODE
- xfree((void *) str);
+ xfree((void*) str);
#endif
}
-const char **xml_convert_attrs_to_char_string(const XML_Char **xml_attr)
+const char** xml_convert_attrs_to_char_string(const XML_Char** xml_attr)
{
#ifdef XML_UNICODE
// First count size of array
int size = 0;
int i;
- const XML_Char **ptr;
- const char **char_attrs;
+ const XML_Char** ptr;
+ const char** char_attrs;
if (xml_attr == NULL) {
return NULL;
}
// Allocate space
- char_attrs = xmalloc((size + 1) * sizeof(char *));
+ char_attrs = xmalloc((size + 1) * sizeof(char*));
// Duplicate strings
for (i = 0; i < size; ++i) {
#endif
}
-void xml_free_converted_attrs(const char **attr)
+void xml_free_converted_attrs(const char** attr)
{
#ifdef XML_UNICODE
while (attr != NULL && *attr != NULL) {
- xfree((void *)*attr);
+ xfree((void*)*attr);
++attr;
}
#endif
#include "cet.h"
-cet_cs_vec_t *cet_find_cs_by_name(const char *name);
+cet_cs_vec_t* cet_find_cs_by_name(const char* name);
void cet_register(void);
void cet_deregister(void);
/* short hand transmissions */
-char *cet_str_utf8_to_cp1252(const char *src);
-char *cet_str_cp1252_to_utf8(const char *src);
+char* cet_str_utf8_to_cp1252(const char* src);
+char* cet_str_cp1252_to_utf8(const char* src);
extern cet_cs_vec_t cet_cs_vec_cp1252;
-char *cet_str_iso8859_1_to_utf8(const char *src);
-char *cet_str_utf8_to_iso8859_1(const char *src);
+char* cet_str_iso8859_1_to_utf8(const char* src);
+char* cet_str_utf8_to_iso8859_1(const char* src);
extern cet_cs_vec_t cet_cs_vec_iso8859_1;
-char *cet_str_iso8859_15_to_utf8(const char *src);
-char *cet_str_utf8_to_iso8859_15(const char *src);
+char* cet_str_iso8859_15_to_utf8(const char* src);
+char* cet_str_utf8_to_iso8859_15(const char* src);
extern const cet_cs_vec_t cet_cs_vec_iso8859_15;
-char *cet_str_utf8_to_us_ascii(const char *src);
-char *cet_str_us_ascii_to_utf8(const char *src);
+char* cet_str_utf8_to_us_ascii(const char* src);
+char* cet_str_us_ascii_to_utf8(const char* src);
extern cet_cs_vec_t cet_cs_vec_ansi_x3_4_1968;
-short *cet_str_utf8_to_uni(const char *src, int *length);
+short* cet_str_utf8_to_uni(const char* src, int* length);
extern cet_cs_vec_t cet_cs_vec_utf8;
#endif /* not defined XMLCALL */
#if HAVE_LIBEXPAT
-int XMLCALL cet_lib_expat_UnknownEncodingHandler(void *data, const XML_Char *encoding, XML_Encoding *info);
+int XMLCALL cet_lib_expat_UnknownEncodingHandler(void* data, const XML_Char* encoding, XML_Encoding* info);
#endif
/* helpers */
-char *cet_str_uni_to_any(const short *src, int length, const cet_cs_vec_t *dest_vec);
-char *cet_str_any_to_any(const char *src, const cet_cs_vec_t *src_vec, const cet_cs_vec_t *dest_vec);
-int cet_valid_char(const char *src, const cet_cs_vec_t *vec);
+char* cet_str_uni_to_any(const short* src, int length, const cet_cs_vec_t* dest_vec);
+char* cet_str_any_to_any(const char* src, const cet_cs_vec_t* src_vec, const cet_cs_vec_t* dest_vec);
+int cet_valid_char(const char* src, const cet_cs_vec_t* vec);
-int cet_gbfprintf(gbfile *stream, const cet_cs_vec_t *src_vec, const char *fmt, ...);
+int cet_gbfprintf(gbfile* stream, const cet_cs_vec_t* src_vec, const char* fmt, ...);
/* cet_convert_string: !!! ONLY VALID WITHIN 'cet_convert_strings' process !!! */
-char *cet_convert_string(char *str);
+char* cet_convert_string(char* str);
/* gpsbabel extensions */
-void cet_convert_init(const char *cs_name, const int force);
-void cet_convert_strings(const cet_cs_vec_t *source, const cet_cs_vec_t *target, const char *format);
+void cet_convert_init(const char* cs_name, const int force);
+void cet_convert_strings(const cet_cs_vec_t* source, const cet_cs_vec_t* target, const char* format);
void cet_convert_deinit(void);
-void cet_disp_character_set_names(FILE *fout);
+void cet_disp_character_set_names(FILE* fout);
/*
* Conversion from XML_Char string to char string. If XML_Char is the
* it.
*/
-const char *xml_convert_to_char_string_n(const XML_Char *str, int *nbytes);
-const char *xml_convert_to_char_string(const XML_Char *str);
-void xml_free_converted_string(const char *str);
+const char* xml_convert_to_char_string_n(const XML_Char* str, int* nbytes);
+const char* xml_convert_to_char_string(const XML_Char* str);
+void xml_free_converted_string(const char* str);
-const char **xml_convert_attrs_to_char_string(const XML_Char **xml_attr);
-void xml_free_converted_attrs(const char **attr);
+const char** xml_convert_attrs_to_char_string(const XML_Char** xml_attr);
+void xml_free_converted_attrs(const char** attr);
#endif
#define TRACK_POINT_SIZE sizeof(struct cetus_track_point_s)
-static pdbfile *file_in, *file_out;
-static const char *out_fname;
+static pdbfile* file_in, *file_out;
+static const char* out_fname;
static short_handle mkshort_wr_handle;
static int ct;
-static char *dbname = NULL;
-static char *appendicon = NULL;
+static char* dbname = NULL;
+static char* appendicon = NULL;
static
arglist_t cetus_args[] = {
ARG_TERMINATOR
};
-static waypoint *
-read_track_point(cetus_track_point_t *data, const time_t basetime)
+static waypoint*
+read_track_point(cetus_track_point_t* data, const time_t basetime)
{
int i, ilat, ilon;
- waypoint *wpt;
+ waypoint* wpt;
ilat = be_read32(&data->latitude);
ilon = be_read32(&data->longitude);
static void
-read_tracks(const pdbfile *pdb)
+read_tracks(const pdbfile* pdb)
{
- pdbrec_t *pdb_rec;
+ pdbrec_t* pdb_rec;
int reclen, records, total, points, dropped;
char descr[(2 * TRACK_POINT_SIZE) + 1];
char temp_descr[TRACK_POINT_SIZE + 1];
- cetus_track_head_t *head;
- waypoint *wpt;
- route_head *track;
+ cetus_track_head_t* head;
+ waypoint* wpt;
+ route_head* track;
time_t basetime;
track = route_head_alloc();
for (pdb_rec = pdb->rec_list; pdb_rec; pdb_rec = pdb_rec->next) {
int i, magic;
- char *c = (char *)pdb_rec->data;
+ char* c = (char*)pdb_rec->data;
magic = be_read32(c);
if (magic != MYTRACK) {
struct tm tm;
case 0: /* track header */
- head = (cetus_track_head_t *)c;
+ head = (cetus_track_head_t*)c;
if (head->id[0] != 'C' || head->id[1] != 'G') {
fatal(MYNAME ": Invalid track header!\n");
}
break;
default:
- wpt = read_track_point((cetus_track_point_t *)c, basetime);
+ wpt = read_track_point((cetus_track_point_t*)c, basetime);
if (wpt != NULL) {
track_add_wpt(track, wpt);
points++;
}
static void
-read_waypts(const pdbfile *pdb)
+read_waypts(const pdbfile* pdb)
{
- struct cetus_wpt_s *rec;
- pdbrec_t *pdb_rec;
- char *vdata;
+ struct cetus_wpt_s* rec;
+ pdbrec_t* pdb_rec;
+ char* vdata;
for (pdb_rec = pdb->rec_list; pdb_rec; pdb_rec = pdb_rec->next) {
- waypoint *wpt_tmp;
+ waypoint* wpt_tmp;
int i;
wpt_tmp = waypt_new();
- rec = (struct cetus_wpt_s *) pdb_rec->data;
+ rec = (struct cetus_wpt_s*) pdb_rec->data;
if (be_read32(&rec->elevation) == -100000000) {
wpt_tmp->altitude = unknown_alt;
} else {
}
- vdata = (char *) pdb_rec->data + sizeof(*rec);
+ vdata = (char*) pdb_rec->data + sizeof(*rec);
wpt_tmp->shortname = xstrdup(vdata);
vdata = vdata + strlen(vdata) + 1;
/* --------------------------------------------------------------------------- */
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
file_in = pdb_open(fname, MYNAME);
}
}
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
file_out = pdb_create(fname, MYNAME);
out_fname = fname;
static void
-cetus_writewpt(const waypoint *wpt)
+cetus_writewpt(const waypoint* wpt)
{
- struct cetus_wpt_s *rec;
- struct tm *tm;
- char *vdata;
- char *desc_long;
- char *desc_short;
- char *desc_geo;
- char *desc;
+ struct cetus_wpt_s* rec;
+ struct tm* tm;
+ char* vdata;
+ char* desc_long;
+ char* desc_short;
+ char* desc_geo;
+ char* desc;
rec = (struct cetus_wpt_s*) xcalloc(sizeof(*rec)+18 + NOTESZ + DESCSZ,1);
rec->sat = wpt->sat ? wpt->sat : 0xff;
- vdata = (char *)rec + sizeof(*rec);
+ vdata = (char*)rec + sizeof(*rec);
if (wpt->shortname) {
- char *sn = xstrdup(wpt->shortname);
+ char* sn = xstrdup(wpt->shortname);
strncpy(vdata, sn, 16);
vdata[15] = '\0';
xfree(sn);
}
if (wpt->gc_data->desc_short.utfstring) {
- char *stripped_html = strip_html(&wpt->gc_data->desc_short);
+ char* stripped_html = strip_html(&wpt->gc_data->desc_short);
desc_short = xstrdup(wpt->gc_data->diff == 0 ? "\n\n" : "");
desc_short = xstrappend(desc_short, xstrdup(stripped_html));
xfree(stripped_html);
}
if (wpt->gc_data->desc_long.utfstring) {
- char *stripped_html = strip_html(&wpt->gc_data->desc_long);
+ char* stripped_html = strip_html(&wpt->gc_data->desc_long);
desc_long = xstrdup("\n\n");
desc_long = xstrappend(desc_long, xstrdup(stripped_html));
xfree(stripped_html);
vdata += strlen(vdata) + 1;
if (wpt->gc_data->hint) {
- char *hint = xstrdup(wpt->gc_data->hint);
+ char* hint = xstrdup(wpt->gc_data->hint);
rec->type = WptCache;
strncpy(vdata, hint, NOTESZ + 1) ;
xfree(hint);
}
vdata += strlen(vdata) + 1;
- pdb_write_rec(file_out, 0, 2, ct++, rec, (char *)vdata - (char *)rec);
+ pdb_write_rec(file_out, 0, 2, ct++, rec, (char*)vdata - (char*)rec);
xfree(rec);
}
struct hdr {
- char *wpt_name;
- waypoint *wpt;
+ char* wpt_name;
+ waypoint* wpt;
};
static
int
-compare(const void *a, const void *b)
+compare(const void* a, const void* b)
{
- const struct hdr *wa = (const struct hdr*) a;
- const struct hdr *wb = (const struct hdr*) b;
+ const struct hdr* wa = (const struct hdr*) a;
+ const struct hdr* wb = (const struct hdr*) b;
return strcmp(wa->wpt->shortname, wb->wpt->shortname);
}
data_write(void)
{
int i, ct = waypt_count();
- struct hdr *htable, *bh;
- queue *elem, *tmp;
+ struct hdr* htable, *bh;
+ queue* elem, *tmp;
extern queue waypt_head;
- waypoint *waypointp;
+ waypoint* waypointp;
mkshort_wr_handle = mkshort_new_handle();
setshort_length(mkshort_wr_handle, 15);
setshort_whitespace_ok(mkshort_wr_handle, 0);
bh = htable;
QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
- waypointp = (waypoint *) elem;
+ waypointp = (waypoint*) elem;
bh->wpt = waypointp;
if (global_opts.synthesize_shortnames && waypointp->description) {
if (waypointp->shortname) {
#include "uuid.h"
-static gbfile *fd, *ofd;
+static gbfile* fd, *ofd;
#define MYNAME "coastexp"
#define MY_CBUF 4096
#define MY_XBUF 128
-static char *element; // Current element being parsed
-static char *cdatastr; // Current XML character data being built up (until a <lf>)
+static char* element; // Current element being parsed
+static char* cdatastr; // Current XML character data being built up (until a <lf>)
/* CE-specific mark structure - used for both route marks and standalone marks */
struct CE_MARK {
queue Q;
- char *id; // CE's mark ID (of the form "{<guid>}")
- char *created; // CE's creation time (of the form "<YYYY><MM><DD>T<HH><MM><SS>Z")
- waypoint *wp; // GPSBabel waypoint
+ char* id; // CE's mark ID (of the form "{<guid>}")
+ char* created; // CE's creation time (of the form "<YYYY><MM><DD>T<HH><MM><SS>Z")
+ waypoint* wp; // GPSBabel waypoint
int used; // Is this mark used in a route or not?
};
typedef struct CE_MARK ce_mark;
/* CE-specific route structure */
struct CE_ROUTE {
queue Q;
- char *id; // CE's route ID (of the form "{<guid>}")
- route_head *r; // GPSBabel route header
+ char* id; // CE's route ID (of the form "{<guid>}")
+ route_head* r; // GPSBabel route header
queue ce_mark_head; // list of CE marks in this route
};
typedef struct CE_ROUTE ce_route;
static queue ce_route_head; // List of routes currently found
-static ce_route *currentRoute = NULL; // Current route being processed
+static ce_route* currentRoute = NULL; // Current route being processed
static queue ce_mark_head; // List of stand-alone marks currently found
-static ce_mark *currentMark = NULL; // Current mark being processed
-static char *time_buffer = NULL; // Time buffer for processing times
-static char *uuid_buffer = NULL; // UUID buffer for processing uuid's
-static char *xml_buffer = NULL; // XML buffer for processing XML strings
+static ce_mark* currentMark = NULL; // Current mark being processed
+static char* time_buffer = NULL; // Time buffer for processing times
+static char* uuid_buffer = NULL; // UUID buffer for processing uuid's
+static char* xml_buffer = NULL; // XML buffer for processing XML strings
static int inRoute = 0; // Are we processing a route?
static int inMark = 0; // Are we processing a mark?
/* Add a route to the list of routes */
static void
-ce_add_route(ce_route *route)
+ce_add_route(ce_route* route)
{
ENQUEUE_TAIL(&ce_route_head, &route->Q);
}
/* Add a mark to the list of stand-alone marks */
static void
-ce_add_mark(ce_mark *mark)
+ce_add_mark(ce_mark* mark)
{
ENQUEUE_TAIL(&ce_mark_head, &mark->Q);
}
/* Add a mark to the specified route */
static void
-ce_add_mark_to_route(ce_route *route, ce_mark *mark)
+ce_add_mark_to_route(ce_route* route, ce_mark* mark)
{
ENQUEUE_TAIL(&route->ce_mark_head, &mark->Q);
}
/* Free a mark */
static void
-ce_free_mark(ce_mark *mark)
+ce_free_mark(ce_mark* mark)
{
dequeue(&mark->Q);
if (mark->id) {
/* Free a route */
static void
-ce_free_route(ce_route *route)
+ce_free_route(ce_route* route)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&route->ce_mark_head, elem, tmp) {
- ce_mark *mark = (ce_mark *) elem;
+ ce_mark* mark = (ce_mark*) elem;
ce_free_mark(mark);
}
xfree(route->id);
}
/* Allocate a mark */
-static ce_mark *
-ce_alloc_mark(const waypoint *wpt, const char *id)
+static ce_mark*
+ce_alloc_mark(const waypoint* wpt, const char* id)
{
- ce_mark *res = xcalloc(sizeof(ce_mark), 1);
- res->id = (char *) id;
- res->wp = (waypoint *) wpt;
+ ce_mark* res = (ce_mark*) xcalloc(sizeof(ce_mark), 1);
+ res->id = (char*) id;
+ res->wp = (waypoint*) wpt;
return res;
}
#if !HAVE_LIBEXPAT
void
-ce_rd_init(const char *fname)
+ce_rd_init(const char* fname)
{
fatal(MYNAME ": This build excluded CoastalExplorer support because expat was not installed.\n");
}
/* Start processing an XML item */
static void
-ce_start(void *data, const XML_Char *xml_el, const XML_Char **xml_attr)
+ce_start(void* data, const XML_Char* xml_el, const XML_Char** xml_attr)
{
- const char *el = xml_convert_to_char_string(xml_el);
- const char **ap;
- const char **attr;
+ const char* el = xml_convert_to_char_string(xml_el);
+ const char** ap;
+ const char** attr;
attr = xml_convert_attrs_to_char_string(xml_attr);
strcpy(element, el);
for (ap = attr; *ap; ap+=2) {
if (0 == strcmp(ap[0], "id")) {
// Create a CE route object and add it to the list of routes
- currentRoute = (ce_route *) xcalloc(sizeof(ce_route), 1);
+ currentRoute = (ce_route*) xcalloc(sizeof(ce_route), 1);
currentRoute->id=xstrdup(ap[1]);
currentRoute->r = route_head_alloc();
QUEUE_INIT(¤tRoute->ce_mark_head);
/* Finish processing an XML item */
static void
-ce_end(void *data, const XML_Char *xml_el)
+ce_end(void* data, const XML_Char* xml_el)
{
- const char *el = xml_convert_to_char_string(xml_el);
+ const char* el = xml_convert_to_char_string(xml_el);
if (0 == strcmp(el, "Route")) {
inRoute = 0; /* ??? */
} else if (0 == strcmp(el, "Mark")) {
/* Process some XML character data for the current item */
static void
-ce_cdata(void *dta, const XML_Char *xml_s, int len)
+ce_cdata(void* dta, const XML_Char* xml_s, int len)
{
- const char *origs = xml_convert_to_char_string_n(xml_s, &len);
- const char *s = origs;
+ const char* origs = xml_convert_to_char_string_n(xml_s, &len);
+ const char* s = origs;
if (*s != '\n') {
- char *edatastr;
+ char* edatastr;
// We buffer up characters in 'cdatastr' until a single <lf> is received
if ((strlen(cdatastr) + len) > MY_CBUF) {
printf("Buffer overflow - line too long!");
if (inRoute) {
// We are processing the marks in a route so create a CE mark object
// and add it to the current route
- ce_mark *mark = (ce_mark *) ce_alloc_mark(NULL, xstrdup(s));
+ ce_mark* mark = (ce_mark*) ce_alloc_mark(NULL, xstrdup(s));
ce_add_mark_to_route(currentRoute, mark);
}
} else if (0 == strcmp(element, "Position")) {
if (inMark) {
// We are processing a standalone mark so read the lat/long position
// and create a waypoint to add to the current mark
- char *position = xstrdup(s);
- char *lat = position;
- char *latNorS = position;
- char *lng;
- char *longEorW;
+ char* position = xstrdup(s);
+ char* lat = position;
+ char* latNorS = position;
+ char* lng;
+ char* longEorW;
while (*latNorS != ' ') {
latNorS++;
}
}
} else if (0 == strcmp(element, "Description")) {
// Descriptions we care about may be either for routes or marks
- char *desc = xstrdup(s);
+ char* desc = xstrdup(s);
if (inMark) {
if (!currentMark->wp) {
currentMark->wp = waypt_new();
/* Set up reading the CE input file */
void
-ce_rd_init(const char *fname)
+ce_rd_init(const char* fname)
{
fd = gbfopen(fname, "r", MYNAME);
QUEUE_INIT(&ce_route_head);
XML_SetUnknownEncodingHandler(psr, cet_lib_expat_UnknownEncodingHandler, NULL);
XML_SetElementHandler(psr, ce_start, ce_end);
- cdatastr = xcalloc(MY_CBUF,1);
- element = xcalloc(MY_CBUF,1);
+ cdatastr = (char*) xcalloc(MY_CBUF,1);
+ element = (char*) xcalloc(MY_CBUF,1);
XML_SetCharacterDataHandler(psr, ce_cdata);
}
void
ce_fix_route_mark_waypoints(void)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&ce_route_head, elem, tmp) {
- ce_route *route = (ce_route *) elem;
- queue *elem2, *tmp2;
+ ce_route* route = (ce_route*) elem;
+ queue* elem2, *tmp2;
QUEUE_FOR_EACH(&route->ce_mark_head, elem2, tmp2) {
- ce_mark *mark = (ce_mark *) elem2;
- queue *elem3, *tmp3;
+ ce_mark* mark = (ce_mark*) elem2;
+ queue* elem3, *tmp3;
QUEUE_FOR_EACH(&ce_mark_head, elem3, tmp3) {
- ce_mark *mark2 = (ce_mark *) elem3;
+ ce_mark* mark2 = (ce_mark*) elem3;
if (0 == strcmp(mark->id, mark2->id)) {
mark->wp = waypt_dupe(mark2->wp);
mark2->used = 1;
void
ce_check_route_names(void)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&ce_route_head, elem, tmp) {
- ce_route *route = (ce_route *) elem;
+ ce_route* route = (ce_route*) elem;
if (route->r->rte_name == NULL) {
*cdatastr = '\0';
- strcat(cdatastr, ((ce_mark *) QUEUE_FIRST(&route->ce_mark_head))->wp->shortname);
+ strcat(cdatastr, ((ce_mark*) QUEUE_FIRST(&route->ce_mark_head))->wp->shortname);
strcat(cdatastr, "->");
- strcat(cdatastr, ((ce_mark *) QUEUE_LAST(&route->ce_mark_head))->wp->shortname);
+ strcat(cdatastr, ((ce_mark*) QUEUE_LAST(&route->ce_mark_head))->wp->shortname);
route->r->rte_name = xstrdup(cdatastr);
}
}
void
ce_remove_used_marks(void)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) {
- ce_mark *mark = (ce_mark *) elem;
+ ce_mark* mark = (ce_mark*) elem;
if (mark->used) {
if (mark->wp) {
waypt_free(mark->wp);
void
ce_print_results(void)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&ce_route_head, elem, tmp) {
- queue *elem2, *tmp2;
- ce_route *route = (ce_route *) elem;
+ queue* elem2, *tmp2;
+ ce_route* route = (ce_route*) elem;
printf("Route name=%s id=%s\n", route->r->rte_name, route->id);
QUEUE_FOR_EACH(&route->ce_mark_head, elem2, tmp2) {
- ce_mark *mark = (ce_mark *) elem2;
+ ce_mark* mark = (ce_mark*) elem2;
if (mark->wp == NULL) {
printf(" null\n");
} else {
}
QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) {
- ce_mark *mark = (ce_mark *) elem;
+ ce_mark* mark = (ce_mark*) elem;
printf("Mark name=%s id=%s ", mark->wp->shortname, mark->id);
if (mark->wp == NULL) {
printf("(null)\n");
If doing waypoints, we create only waypoint structures for both route waypoints and
standalone waypoints.
*/
- queue *elem, *tmp;
+ queue* elem, *tmp;
ce_fix_route_mark_waypoints();
ce_check_route_names();
// Add routes to GPSBabel
QUEUE_FOR_EACH(&ce_route_head, elem, tmp) {
- ce_route *route = (ce_route *) elem;
- queue *elem2, *tmp2;
+ ce_route* route = (ce_route*) elem;
+ queue* elem2, *tmp2;
route_add_head(route->r);
QUEUE_FOR_EACH(&route->ce_mark_head, elem2, tmp2) {
- ce_mark *mark = (ce_mark *) elem2;
+ ce_mark* mark = (ce_mark*) elem2;
if (mark->wp) {
route_add_wpt(route->r, mark->wp);
} else {
// Add (unused) marks to GPSBabel
QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) {
- ce_mark *mark = (ce_mark *) elem;
+ ce_mark* mark = (ce_mark*) elem;
waypt_add(mark->wp);
ce_free_mark(mark);
}
/* Setup for writing */
void
-ce_wr_init(const char *fname)
+ce_wr_init(const char* fname)
{
QUEUE_INIT(&ce_mark_head);
// Alloocate all buffers used for writing
- time_buffer = xcalloc(MY_TBUF,1);
- uuid_buffer = xcalloc(MY_UBUF,1);
- xml_buffer = xcalloc(MY_XBUF, 1);
+ time_buffer = (char*) xcalloc(MY_TBUF,1);
+ uuid_buffer = (char*) xcalloc(MY_UBUF,1);
+ xml_buffer = (char*) xcalloc(MY_XBUF, 1);
ofd = gbfopen(fname, "w", MYNAME);
srand(gpsbabel_now);
}
/* Generate a CE-style creation time based on supplied time */
-static char *
+static char*
ce_gen_creation_time(time_t tm)
{
xml_fill_in_time(time_buffer, tm, 0, XML_SHORT_TIME);
}
/* Generate a CE-style creation time based on current time */
-static char *
+static char*
ce_gen_current_time(void)
{
return ce_gen_creation_time(current_time());
}
/* Generate a UUID (has same format as Microsoft registry GUIDs */
-static char *
+static char*
ce_gen_uuid(void)
{
uuid_t uu;
/* Generate route header XML */
static void
-ce_route_hdr(const route_head *rte)
+ce_route_hdr(const route_head* rte)
{
sprintf(xml_buffer, "{%s}", ce_gen_uuid());
write_xml_entity_begin2(ofd, "\t", "Route", "created", ce_gen_current_time(), "id", xml_buffer);
/* Generate route body XML */
static void
-ce_route_disp(const waypoint *waypointp)
+ce_route_disp(const waypoint* waypointp)
{
- char *uuid = ce_gen_uuid();
- char *id = xcalloc(strlen(uuid)+3, 1);
+ char* uuid = ce_gen_uuid();
+ char* id = (char*) xcalloc(strlen(uuid)+3, 1);
sprintf(id, "{%s}", uuid);
currentMark = ce_alloc_mark(waypointp, id);
/* Generate route trailer XML */
static void
-ce_route_tlr(const route_head *rte)
+ce_route_tlr(const route_head* rte)
{
write_xml_entity_end(ofd, "\t\t", "Marks");
write_optional_xml_entity(ofd, "\t\t", "Name", rte->rte_name);
/* Generate waypoint body XML */
static void
-ce_waypt_pr(const waypoint *wp)
+ce_waypt_pr(const waypoint* wp)
{
double latitude = wp->latitude;
char NorS = 'N';
}
}
-static char *
-ce_find_uuid(const waypoint *wpt)
+static char*
+ce_find_uuid(const waypoint* wpt)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) {
- ce_mark *mark = (ce_mark *) elem;
+ ce_mark* mark = (ce_mark*) elem;
if (mark->wp == wpt) {
return mark->id;
}
return NULL;
}
-static waypoint *
-ce_find_wpt(const waypoint *wpt)
+static waypoint*
+ce_find_wpt(const waypoint* wpt)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) {
- ce_mark *mark = (ce_mark *) elem;
+ ce_mark* mark = (ce_mark*) elem;
if ((mark->wp->shortname == wpt->shortname) &&
(mark->wp->latitude == wpt->latitude) &&
(mark->wp->longitude == wpt->longitude)) {
/* Generate a mark XML; look for created id's */
static void
-ce_mark_pr(const waypoint *wp)
+ce_mark_pr(const waypoint* wp)
{
- char *id;
+ char* id;
if (inRoute) {
id = ce_find_uuid(wp);
else if (ce_find_wpt(wp) != NULL) {
return;
} else {
- ce_mark *mark = ce_alloc_mark(wp, NULL);
+ ce_mark* mark = ce_alloc_mark(wp, NULL);
ENQUEUE_TAIL(&ce_mark_head, &mark->Q);
sprintf(xml_buffer, "{%s}", ce_gen_uuid());
id = xml_buffer;
static void
ce_marks_pr(void)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) {
- ce_mark *mark = (ce_mark *) elem;
+ ce_mark* mark = (ce_mark*) elem;
ce_mark_pr(mark->wp);
}
}
static void
ce_marks_flush_all(void)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) {
- ce_mark *mark = (ce_mark *) elem;
+ ce_mark* mark = (ce_mark*) elem;
ce_free_mark(mark);
}
}
ff_vecs_t coastexp_vecs = {
ff_type_file,
- { ff_cap_read|ff_cap_write, ff_cap_none, ff_cap_read|ff_cap_write },
+ { (ff_cap)(ff_cap_read|ff_cap_write), ff_cap_none, (ff_cap)(ff_cap_read|ff_cap_write) },
ce_rd_init,
ce_wr_init,
ce_rd_deinit,
#define SHORT_NAME_LENGTH 16
-static gbfile *fin, *fout;
+static gbfile* fin, *fout;
static int target_index, curr_index;
static int track_info_flag;
static short_handle sh;
static int radius;
static int input_datum;
-static route_head *curr_track;
-static route_head *curr_route;
+static route_head* curr_track;
+static route_head* curr_route;
/* placeholders for options */
-static char *option_icon;
-static char *option_index;
-static char *option_radius;
-static char *option_snlen;
+static char* option_icon;
+static char* option_index;
+static char* option_radius;
+static char* option_snlen;
static
arglist_t compegps_args[] = {
};
static
-void fix_datum(double *lat, double *lon)
+void fix_datum(double* lat, double* lon)
{
double amt;
}
static void
-compegps_parse_date(const char *c, struct tm* tm)
+compegps_parse_date(const char* c, struct tm* tm)
{
char month[4];
int year;
}
static void
-compegps_parse_time(const char *c, struct tm* tm)
+compegps_parse_time(const char* c, struct tm* tm)
{
tm->tm_hour = atoi(c);
tm->tm_min = atoi(c+3);
/* specialized readers */
static waypoint*
-parse_wpt(char *buff)
+parse_wpt(char* buff)
{
int col = -1;
- char *c, *cx;
- waypoint *wpt = waypt_new();
+ char* c, *cx;
+ waypoint* wpt = waypt_new();
struct tm tm;
int has_time = 0;
memset(&tm, 0, sizeof(tm));
}
static void
-parse_wpt_info(const char *buff, waypoint *wpt) /* "w" */
+parse_wpt_info(const char* buff, waypoint* wpt) /* "w" */
{
- char *c;
+ char* c;
int col = -1;
double fx;
}
}
-static waypoint *
-parse_trkpt(char *buff)
+static waypoint*
+parse_trkpt(char* buff)
{
int col = -1;
- char *c;
+ char* c;
struct tm tm;
- waypoint *wpt = waypt_new();
+ waypoint* wpt = waypt_new();
c = strstr(buff, "A ");
if (c == buff) {
}
static void
-parse_track_info(const char *buff, route_head *track) /* "t" */
+parse_track_info(const char* buff, route_head* track) /* "t" */
{
- char *c;
+ char* c;
int col = -1;
c = csv_lineparse(buff, "|", "", col++);
}
static void
-parse_rte_info(const char *buff, route_head *route) /* "R" */
+parse_rte_info(const char* buff, route_head* route) /* "R" */
{
- char *c;
+ char* c;
int col = -1;
c = csv_lineparse(buff, ",", "", col++);
/* main functions */
static void
-compegps_rd_init(const char *fname)
+compegps_rd_init(const char* fname)
{
fin = gbfopen(fname, "rb", MYNAME);
input_datum = DATUM_WGS84;
static void
compegps_data_read(void)
{
- char *buff;
+ char* buff;
int line = 0;
int input_datum;
- waypoint *wpt = NULL;
- route_head *route = NULL;
- route_head *track = NULL;
+ waypoint* wpt = NULL;
+ route_head* route = NULL;
+ route_head* track = NULL;
while ((buff = gbfgetstr(fin))) {
- char *cin = buff;
- char *ctail;
+ char* cin = buff;
+ char* ctail;
if ((line++ == 0) && fin->unicode) {
cet_convert_init(CET_CHARSET_UTF8, 1);
/* ----------------------------------------------------------- */
static void
-write_waypt_cb(const waypoint *wpt)
+write_waypt_cb(const waypoint* wpt)
{
- char *name;
+ char* name;
if (curr_index != target_index) {
return;
if ((wpt->icon_descr != NULL) || (wpt->wpt_flags.proximity) || \
(option_icon != NULL)) {
- char *icon = option_icon;
+ char* icon = option_icon;
if (wpt->icon_descr != NULL) {
- icon = (char *) wpt->icon_descr;
+ icon = (char*) wpt->icon_descr;
}
gbfprintf(fout, "w %s,0,0.0,16777215,255,1,7,,%.1f\n",
}
static void
-write_route_hdr_cb(const route_head *rte)
+write_route_hdr_cb(const route_head* rte)
{
- char *name;
- curr_route = (route_head *) rte;
+ char* name;
+ curr_route = (route_head*) rte;
curr_index++;
if (curr_index != target_index) {
return;
}
static void
-write_track_hdr_cb(const route_head *trk)
+write_track_hdr_cb(const route_head* trk)
{
track_info_flag = 0;
- curr_track = (route_head *) trk;
+ curr_track = (route_head*) trk;
curr_index++;
if (curr_index != target_index) {
}
static void
-write_trkpt_cb(const waypoint *wpt)
+write_trkpt_cb(const waypoint* wpt)
{
char buff[128];
struct tm tm;
if (track_info_flag != 0) {
track_info_flag = 0;
if (curr_track->rte_name != NULL) {
- char *name;
+ char* name;
name = csv_stringclean(curr_track->rte_name, "|");
gbfprintf(fout, "t 4294967295|%s|-1|-1\n", name);
/* --------------------------------------------------------------------------- */
static void
-compegps_wr_init(const char *fname)
+compegps_wr_init(const char* fname)
{
fout = gbfopen(fname, "w", MYNAME);
sh = mkshort_new_handle();
pdb_float elevation; /* feet */
};
-static pdbfile *file_in, *file_out;
-static const char *out_fname;
+static pdbfile* file_in, *file_out;
+static const char* out_fname;
static int ct;
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
file_in = pdb_open(fname, MYNAME);
}
}
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
file_out = pdb_create(fname, MYNAME);
out_fname = fname;
}
static waypoint*
-read_version0(void *data)
+read_version0(void* data)
{
- char *vdata;
- waypoint *wpt_tmp;
+ char* vdata;
+ waypoint* wpt_tmp;
struct record0* rec = (struct record0*)data;
wpt_tmp = waypt_new();
DEG(pdb_read_double(&rec->latitude));
wpt_tmp->altitude = FEET_TO_METERS(be_read32(&rec->elevation));
- vdata = (char *) data + sizeof(*rec);
+ vdata = (char*) data + sizeof(*rec);
wpt_tmp->shortname = xstrdup(vdata);
vdata = vdata + strlen(vdata) + 1;
}
static waypoint*
-read_version1(void *data)
+read_version1(void* data)
{
- char *vdata;
- waypoint *wpt_tmp;
+ char* vdata;
+ waypoint* wpt_tmp;
struct record1* rec = (struct record1*)data;
wpt_tmp = waypt_new();
wpt_tmp->altitude =
FEET_TO_METERS(pdb_read_double(&rec->elevation));
- vdata = (char *) data + sizeof(*rec);
+ vdata = (char*) data + sizeof(*rec);
wpt_tmp->shortname = xstrdup(vdata);
vdata = vdata + strlen(vdata) + 1;
}
static waypoint*
-read_version3(void *data)
+read_version3(void* data)
{
- char *vdata;
- waypoint *wpt_tmp;
+ char* vdata;
+ waypoint* wpt_tmp;
struct record3* rec = (struct record3*)data;
wpt_tmp = waypt_new();
wpt_tmp->altitude =
FEET_TO_METERS(pdb_read_double(&rec->elevation));
- vdata = (char *) data + sizeof(*rec);
+ vdata = (char*) data + sizeof(*rec);
wpt_tmp->shortname = xstrdup(vdata);
vdata = vdata + strlen(vdata) + 1;
}
static waypoint*
-read_version4(void *data)
+read_version4(void* data)
{
- char *vdata;
- waypoint *wpt_tmp;
+ char* vdata;
+ waypoint* wpt_tmp;
struct record4* rec = (struct record4*)data;
wpt_tmp = waypt_new();
wpt_tmp->altitude =
FEET_TO_METERS(pdb_read_float(&rec->elevation));
- vdata = (char *) data + sizeof(*rec);
+ vdata = (char*) data + sizeof(*rec);
wpt_tmp->shortname = xstrdup(vdata);
vdata = vdata + strlen(vdata) + 1;
static void
data_read(void)
{
- pdbrec_t *pdb_rec;
+ pdbrec_t* pdb_rec;
if ((file_in->creator != GXPU_CREATOR && file_in->creator != AP_P_CREATOR) ||
(file_in->type != wayp_TYPE && file_in->type != swpu_TYPE &&
for (pdb_rec = file_in->rec_list; pdb_rec; pdb_rec = pdb_rec->next) {
- waypoint *wpt_tmp;
+ waypoint* wpt_tmp;
switch (file_in->version) {
case 0:
}
static void
-copilot_writewpt(const waypoint *wpt)
+copilot_writewpt(const waypoint* wpt)
{
- struct record4 *rec;
- char *vdata;
+ struct record4* rec;
+ char* vdata;
- rec = (struct record4 *) xcalloc(sizeof(*rec)+1141,1);
+ rec = (struct record4*) xcalloc(sizeof(*rec)+1141,1);
pdb_write_double(&rec->latitude, RAD(wpt->latitude));
pdb_write_double(&rec->longitude, RAD(-wpt->longitude));
pdb_write_float(&rec->elevation,
METERS_TO_FEET(wpt->altitude));
- vdata = (char *)rec + sizeof(*rec);
+ vdata = (char*)rec + sizeof(*rec);
if (wpt->shortname) {
strncpy(vdata, wpt->shortname, 10);
vdata[9] = '\0';
}
vdata += strlen(vdata) + 1;
- pdb_write_rec(file_out, 0, 2, ct++, rec, (char *)vdata - (char *)rec);
+ pdb_write_rec(file_out, 0, 2, ct++, rec, (char*)vdata - (char*)rec);
xfree(rec);
}
#define APPINFO_SIZE sizeof(appinfo_t)
-static pdbfile *file_in, *file_out;
-static const char *out_fname;
-static const char *in_fname; /* We might need that for naming tracks */
+static pdbfile* file_in, *file_out;
+static const char* out_fname;
+static const char* in_fname; /* We might need that for naming tracks */
static short_handle mkshort_wr_handle;
static int ct;
-static char *zerocat = NULL;
-static char *internals = NULL;
+static char* zerocat = NULL;
+static char* internals = NULL;
static
arglist_t coto_args[] = {
};
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
file_in = pdb_open(fname, MYNAME);
in_fname = fname;
}
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
file_out = pdb_create(fname, MYNAME);
out_fname = fname;
/* helpers */
-static char *
-coto_get_icon_descr(int category, const appinfo_t *app)
+static char*
+coto_get_icon_descr(int category, const appinfo_t* app)
{
char buff[CATEGORY_NAME_LENGTH + 1] = "Not Assigned";
if ((category >= 0) && (category < 16)) {
static void
coto_track_read(void)
{
- struct record_track *rec;
- pdbrec_t *pdb_rec;
- route_head *trk_head;
- char *track_name;
+ struct record_track* rec;
+ pdbrec_t* pdb_rec;
+ route_head* trk_head;
+ char* track_name;
if (strncmp(file_in->name, "cotoGPS TrackDB", PDB_DBNAMELEN) != 0)
// Use database name if not default
track_name = xstrndup(file_in->name, PDB_DBNAMELEN);
} else {
// Use filename for new track title
- const char *fnametmp = strrchr(in_fname, '/');
+ const char* fnametmp = strrchr(in_fname, '/');
if (fnametmp == NULL) {
fnametmp = strrchr(in_fname, '\\');
}
trk_head->rte_name = track_name;
for (pdb_rec = file_in->rec_list; pdb_rec; pdb_rec = pdb_rec->next) {
- waypoint *wpt_tmp;
+ waypoint* wpt_tmp;
wpt_tmp = waypt_new();
- rec = (struct record_track *) pdb_rec->data;
+ rec = (struct record_track*) pdb_rec->data;
wpt_tmp->longitude = DEG(-pdb_read_double(&rec->longitude));
wpt_tmp->latitude = DEG(pdb_read_double(&rec->latitude));
if (internals) {
// Parse the option as xcsv delimiter
- const char *inter = xcsv_get_char_from_constant_table(internals);
+ const char* inter = xcsv_get_char_from_constant_table(internals);
char temp[256];
snprintf(temp, sizeof(temp), "%.20f%s%.20f%s%.20f%s%.20f", pdb_read_double(&rec->distance), inter,
pdb_read_double(&rec->arc), inter, pdb_read_double(&rec->x), inter, pdb_read_double(&rec->y));
static void
coto_wpt_read(void)
{
- struct record_wpt *rec;
- pdbrec_t *pdb_rec;
- appinfo_t *app;
- app = (struct appinfo *) file_in->appinfo;
+ struct record_wpt* rec;
+ pdbrec_t* pdb_rec;
+ appinfo_t* app;
+ app = (struct appinfo*) file_in->appinfo;
for (pdb_rec = file_in->rec_list; pdb_rec; pdb_rec = pdb_rec->next) {
- waypoint *wpt_tmp;
- char *c;
+ waypoint* wpt_tmp;
+ char* c;
wpt_tmp = waypt_new();
- rec = (struct record_wpt *) pdb_rec->data;
+ rec = (struct record_wpt*) pdb_rec->data;
wpt_tmp->longitude = DEG(-pdb_read_double(&rec->lon));
wpt_tmp->latitude = DEG(pdb_read_double(&rec->lat));
static void
coto_prepare_wpt_write(void)
{
- struct appinfo *ai;
+ struct appinfo* ai;
file_out->name[PDB_DBNAMELEN-1] = 0;
file_out->attr = PDB_FLAG_BACKUP;
file_out->appinfo_len = APPINFO_SIZE;
file_out->appinfo = calloc(APPINFO_SIZE,1);
- ai = (struct appinfo *) file_out->appinfo;
+ ai = (struct appinfo*) file_out->appinfo;
be_write16(&ai->renamedCategories, 31); // Don't ask me why...
if (zerocat) {
strncpy(ai->categories[0], zerocat, 16);
}
static void
-coto_wpt_write(const waypoint *wpt)
+coto_wpt_write(const waypoint* wpt)
{
- struct record_wpt *rec;
- struct appinfo *ai = (struct appinfo *) file_out->appinfo;
- char *notes = NULL;
- char *shortname = NULL;
+ struct record_wpt* rec;
+ struct appinfo* ai = (struct appinfo*) file_out->appinfo;
+ char* notes = NULL;
+ char* shortname = NULL;
int size;
gbuint8 cat = 0;
int i;
}
}
- pdb_write_rec(file_out, 0, cat, ct++, (const gbuint8 *)rec, size);
+ pdb_write_rec(file_out, 0, cat, ct++, (const gbuint8*)rec, size);
xfree(shortname);
xfree(rec);
#define CST_REFERENCE 4
#define CST_VERSION 5
-static gbfile *fin;
+static gbfile* fin;
-static route_head *temp_route;
+static route_head* temp_route;
/* placeholders for options */
/* helpers */
static void
-cst_add_wpt(const route_head *track, waypoint *wpt)
+cst_add_wpt(const route_head* track, waypoint* wpt)
{
if ((wpt == NULL) || (track == NULL)) {
return;
}
route_add_wpt(temp_route, waypt_dupe(wpt));
}
- track_add_wpt((route_head *)track, (waypoint *)wpt);
+ track_add_wpt((route_head*)track, (waypoint*)wpt);
}
-static char *
-cst_make_url(char *str)
+static char*
+cst_make_url(char* str)
{
int len = strlen(str);
- char *res;
+ char* res;
if (len < 3) {
return NULL;
res[8] = *str++;
res = xstrappend(res, str);
{
- char *c;
+ char* c;
int i;
c = res; /* replace all backslashes with a slash */
}
if (i > 0) { /* .. and replace them with "%20" */
- char *src, *dest, *last;
+ char* src, *dest, *last;
last = src = res;
- res = dest = xcalloc(strlen(src) + (2*i) + 1, 1);
+ res = dest = (char*) xcalloc(strlen(src) + (2*i) + 1, 1);
while ((c = strchr(src, ' '))) {
if (c != src) {
strncpy(dest, src, c - src);
/* --------------------------------------------------------------------------- */
static void
-cst_rd_init(const char *fname)
+cst_rd_init(const char* fname)
{
fin = gbfopen(fname, "rb", MYNAME);
temp_route = NULL;
static void
cst_data_read(void)
{
- char *buff;
+ char* buff;
int line = 0;
int data_lines = -1;
int line_of_count = -1;
int section = CST_UNKNOWN;
int cst_version;
int cst_points = -1;
- route_head *track = NULL;
- waypoint *wpt = NULL;
+ route_head* track = NULL;
+ waypoint* wpt = NULL;
while ((buff = gbfgetstr(fin))) {
- char *cin = buff;
+ char* cin = buff;
if ((line++ == 0) && fin->unicode) {
cet_convert_init(CET_CHARSET_UTF8, 1);
} else {
int interp, i;
char name[256];
- char *pow;
+ char* pow;
if (data_lines < 0) {
if ((2 != sscanf(cin, "%d %128s", &i, name)) ||
track = route_head_alloc();
track_add_head(track);
} else if (strncmp(name, "NAME:", 5) == 0) {
- wpt->shortname = xstrdup(((char *)&name) + 5);
+ wpt->shortname = xstrdup(((char*)&name) + 5);
}
pow = strrchr(cin, '^');
#if 0
static void
-cst_wr_init(const char *fname)
+cst_wr_init(const char* fname)
{
fout = gbfopen(fname, "w", MYNAME);
}
}
static void
-cst_route_hdr(const route_head *rte)
+cst_route_hdr(const route_head* rte)
{
}
static void
-cst_route_tlr(const route_head *rte)
+cst_route_tlr(const route_head* rte)
{
}
static void
-cst_write_wpt(const waypoint *wpt)
+cst_write_wpt(const waypoint* wpt)
{
}
} xcsv_token;
// Static definition of in_word_set to meet C99 rules as used by Clang.
-static struct xt_mapping *
-in_word_set(register const char *str, register unsigned int len);
+static struct xt_mapping*
+in_word_set(register const char* str, register unsigned int len);
#include "xcsv_tokens.gperf"
/****************************************************************************/
xcsv_file_t xcsv_file;
-extern char *xcsv_urlbase;
-extern char *prefer_shortnames;
+extern char* xcsv_urlbase;
+extern char* prefer_shortnames;
#if CSVFMTS_ENABLED
static double pathdist = 0;
static double oldlat = 999;
static int waypt_out_count;
-static route_head *csv_track, *csv_route;
+static route_head* csv_track, *csv_route;
static double utm_northing, utm_easting, utm_zone = 0;
static char utm_zonec;
#endif // CSVFMTS_ENABLED
/* usage: p = csv_stringclean(stringtoclean, "&,\"") */
/* (strip out ampersands, commas, and quotes. */
/*********************************************************************/
-char *
+char*
#ifdef DEBUG_MEM
-CSV_STRINGCLEAN(const char *string, const char *chararray, DEBUG_PARAMS)
+CSV_STRINGCLEAN(const char* string, const char* chararray, DEBUG_PARAMS)
#else
-csv_stringclean(const char *string, const char *chararray)
+csv_stringclean(const char* string, const char* chararray)
#endif
{
- char * p1;
- char * p2;
- const char * cp;
- char * tmp = xxstrdup(string,file,line);
+ char* p1;
+ char* p2;
+ const char* cp;
+ char* tmp = xxstrdup(string,file,line);
if ((! string) || (! chararray)) {
return (tmp);
/* returns a copy of the modified string */
/* usage: p = csv_stringtrim(string, "\"", 0) */
/***********************************************************************************/
-char *
+char*
#ifdef DEBUG_MEM
-CSV_STRINGTRIM(const char *string, const char *enclosure, int strip_max, DEBUG_PARAMS)
+CSV_STRINGTRIM(const char* string, const char* enclosure, int strip_max, DEBUG_PARAMS)
#else
-csv_stringtrim(const char *string, const char *enclosure, int strip_max)
+csv_stringtrim(const char* string, const char* enclosure, int strip_max)
#endif
{
- static const char *p1 = NULL;
- char *p2 = NULL;
- char * tmp = xxstrdup(string,file,line);
+ static const char* p1 = NULL;
+ char* p2 = NULL;
+ char* tmp = xxstrdup(string,file,line);
size_t elen;
int stripped = 0;
/* usage: p = csv_lineparse(string, ",", "\"", line) [initial call] */
/* p = csv_lineparse(NULL, ",", "\"", line) [subsequent calls] */
/*****************************************************************************/
-char *
-csv_lineparse(const char *stringstart, const char *delimited_by,
- const char *enclosed_in, const int line_no)
+char*
+csv_lineparse(const char* stringstart, const char* delimited_by,
+ const char* enclosed_in, const int line_no)
{
- const char *sp;
- static const char *p = NULL;
- static char *tmp = NULL;
+ const char* sp;
+ static const char* p = NULL;
+ static char* tmp = NULL;
size_t dlen = 0, elen = 0, efound = 0;
int enclosedepth = 0;
short int dfound;
}
/* allocate enough space for this data field */
- tmp = (char *) xcalloc((p - sp) + 1, sizeof(char));
+ tmp = (char*) xcalloc((p - sp) + 1, sizeof(char));
strncpy(tmp, sp, (p - sp));
tmp[p - sp] = '\0';
if (elen && efound) {
- char *c = csv_stringtrim(tmp, enclosed_in, 0);
+ char* c = csv_stringtrim(tmp, enclosed_in, 0);
xfree(tmp);
tmp = c;
}
/* lat = decdir_to_dec("30.1234N"); */
/*****************************************************************************/
static double
-decdir_to_dec(const char * decdir)
+decdir_to_dec(const char* decdir)
{
- char *p;
- const char *cp;
+ char* p;
+ const char* cp;
double rval;
int sign = 0;
/* lat = ddmmdir_to_degrees("30.1234N"); */
/*****************************************************************************/
static double
-ddmmdir_to_degrees(const char * ddmmdir)
+ddmmdir_to_degrees(const char* ddmmdir)
{
// if not N or E, prepend a '-' to ddmm2degrees input
// see XT_LAT_NMEA which handles ddmm directly
*****************************************************************************/
void
-human_to_dec(const char *instr, double *outlat, double *outlon, int which)
+human_to_dec(const char* instr, double* outlat, double* outlon, int which)
{
double unk[3] = {999,999,999};
double lat[3] = {999,999,999};
int lonsign = 0;
int unksign = 1;
- const char *cur;
- double *numres = unk;
+ const char* cur;
+ double* numres = unk;
int numind = 0;
- char *buff;
+ char* buff;
if (strchr(instr, ',') != NULL) {
- char *c;
+ char* c;
buff = xstrdup(instr);
while ((c = strchr(buff, ','))) {
*c = '.';
}
} else {
- buff = (char *)instr;
+ buff = (char*)instr;
}
cur = buff;
*/
void
-dec_to_human(char *buff, const char *format, const char *dirs, double val)
+dec_to_human(char* buff, const char* format, const char* dirs, double val)
{
- char *subformat = NULL;
- const char *formatptr = NULL;
- char *percent = NULL;
- char *type = NULL;
+ char* subformat = NULL;
+ const char* formatptr = NULL;
+ char* percent = NULL;
+ char* type = NULL;
int index = 0;
int intvals[3] = {0,0,0};
/* usage: xcsv_ifield_add("DESCRIPTION", "", "%s") */
/*****************************************************************************/
void
-xcsv_ifield_add(char *key, char *val, char *pfc)
+xcsv_ifield_add(char* key, char* val, char* pfc)
{
- field_map_t *fmp = (field_map_t *) xcalloc(sizeof(*fmp), 1);
- struct xt_mapping *xm = in_word_set(key, strlen(key));
+ field_map_t* fmp = (field_map_t*) xcalloc(sizeof(*fmp), 1);
+ struct xt_mapping* xm = in_word_set(key, strlen(key));
fmp->key = key;
fmp->hashed_key = xm ? xm->xt_token : -1;
/* usage: xcsv_ofield_add("LAT_DECIMAL", "", "%08.5lf") */
/*****************************************************************************/
void
-xcsv_ofield_add(char *key, char *val, char *pfc, int options)
+xcsv_ofield_add(char* key, char* val, char* pfc, int options)
{
- field_map_t *fmp = (field_map_t *) xcalloc(sizeof(*fmp), 1);
- struct xt_mapping *xm = in_word_set(key, strlen(key));
+ field_map_t* fmp = (field_map_t*) xcalloc(sizeof(*fmp), 1);
+ struct xt_mapping* xm = in_word_set(key, strlen(key));
fmp->key = key;
fmp->hashed_key = xm ? xm->xt_token : -1;
/* usage: xcsv_prologue_add("Four score and seven years ago today,") */
/*****************************************************************************/
void
-xcsv_prologue_add(char *prologue)
+xcsv_prologue_add(char* prologue)
{
ogue_t* ogp = (ogue_t*) xcalloc(sizeof(*ogp), 1);
/* usage: xcsv_epilogue_add("shall not perish from the earth.") */
/*****************************************************************************/
void
-xcsv_epilogue_add(char *epilogue)
+xcsv_epilogue_add(char* epilogue)
{
- ogue_t * ogp = (ogue_t*) xcalloc(sizeof(*ogp), 1);
+ ogue_t* ogp = (ogue_t*) xcalloc(sizeof(*ogp), 1);
ogp->val = epilogue;
ENQUEUE_TAIL(&xcsv_file.epilogue, &ogp->Q);
static
time_t
-yyyymmdd_to_time(const char *s)
+yyyymmdd_to_time(const char* s)
{
int t = atol(s);
struct tm tm;
*/
static
time_t
-sscanftime(const char *s, const char *format, const int gmt)
+sscanftime(const char* s, const char* format, const int gmt)
{
struct tm stm;
memset(&stm, 0, sizeof(stm));
static
time_t
-addhms(const char *s, const char *format)
+addhms(const char* s, const char* format)
{
time_t tt =0;
int hour =0;
int min =0;
int sec =0;
- char * ampm = NULL;
+ char* ampm = NULL;
int ac;
ampm = (char*) xmalloc(strlen(s));
static
int
-writetime(char * buff, size_t bufsize, const char * format, time_t t, int gmt)
+writetime(char* buff, size_t bufsize, const char* format, time_t t, int gmt)
{
- static struct tm * stmp;
+ static struct tm* stmp;
if (gmt) {
stmp = gmtime(&t);
/* not used */
static
int
-writeisotime(char * buff, size_t bufsize, const char * format, time_t t)
+writeisotime(char* buff, size_t bufsize, const char* format, time_t t)
{
- static struct tm * stmp;
- char * ibuff = NULL;
+ static struct tm* stmp;
+ char* ibuff = NULL;
int i;
ibuff = xmalloc(bufsize);
static
int
-writehms(char * buff, size_t bufsize, const char * format, time_t t, int gmt)
+writehms(char* buff, size_t bufsize, const char* format, time_t t, int gmt)
{
static struct tm no_time = {0};
- static struct tm * stmp = &no_time;
+ static struct tm* stmp = &no_time;
if (gmt) {
stmp = gmtime(&t);
time_to_yyyymmdd(time_t t)
{
long b;
- struct tm *tm = gmtime(&t);
+ struct tm* tm = gmtime(&t);
b = (1900 + tm->tm_year) * 10000 +
(1 + tm->tm_mon) * 100 +
return b;
}
-static garmin_fs_t *
-gmsd_init(waypoint *wpt)
+static garmin_fs_t*
+gmsd_init(waypoint* wpt)
{
- garmin_fs_t *gmsd = GMSD_FIND(wpt);
+ garmin_fs_t* gmsd = GMSD_FIND(wpt);
if (gmsd == NULL) {
gmsd = garmin_fs_alloc(-1);
- fs_chain_add(&wpt->fs, (format_specific_data *) gmsd);
+ fs_chain_add(&wpt->fs, (format_specific_data*) gmsd);
}
return gmsd;
}
/* usage: xcsv_parse_val("-123.34", *waypt, *field_map) */
/*****************************************************************************/
static void
-xcsv_parse_val(const char *s, waypoint *wpt, const field_map_t *fmp,
- route_head **trk)
+xcsv_parse_val(const char* s, waypoint* wpt, const field_map_t* fmp,
+ route_head** trk)
{
- char *enclosure = "";
- geocache_data *gc_data = NULL;
+ char* enclosure = "";
+ geocache_data* gc_data = NULL;
if (!fmp->printfc) {
fatal(MYNAME ": xcsv style '%s' is missing format specifier", fmp->key);
utm_northing = atof(s);
break;
case XT_UTM: {
- char *ss;
+ char* ss;
int i = 0;;
utm_zone = strtod(s, &ss);
break;
/* GMSD ****************************************************************/
case XT_COUNTRY: {
- garmin_fs_t *gmsd = gmsd_init(wpt);
+ garmin_fs_t* gmsd = gmsd_init(wpt);
GMSD_SET(country, csv_stringtrim(s, enclosure, 0));
}
break;
case XT_STATE: {
- garmin_fs_t *gmsd = gmsd_init(wpt);
+ garmin_fs_t* gmsd = gmsd_init(wpt);
GMSD_SET(state, csv_stringtrim(s, enclosure, 0));
}
break;
case XT_CITY: {
- garmin_fs_t *gmsd = gmsd_init(wpt);
+ garmin_fs_t* gmsd = gmsd_init(wpt);
GMSD_SET(city, csv_stringtrim(s, enclosure, 0));
}
break;
case XT_STREET_ADDR: {
- garmin_fs_t *gmsd = gmsd_init(wpt);
+ garmin_fs_t* gmsd = gmsd_init(wpt);
GMSD_SET(addr, csv_stringtrim(s, enclosure, 0));
}
break;
case XT_POSTAL_CODE: {
- garmin_fs_t *gmsd = gmsd_init(wpt);
+ garmin_fs_t* gmsd = gmsd_init(wpt);
GMSD_SET(postal_code, csv_stringtrim(s, enclosure, 0));
}
break;
case XT_PHONE_NR: {
- garmin_fs_t *gmsd = gmsd_init(wpt);
+ garmin_fs_t* gmsd = gmsd_init(wpt);
GMSD_SET(phone_nr, csv_stringtrim(s, enclosure, 0));
}
break;
case XT_FACILITY: {
- garmin_fs_t *gmsd = gmsd_init(wpt);
+ garmin_fs_t* gmsd = gmsd_init(wpt);
GMSD_SET(facility, csv_stringtrim(s, enclosure, 0));
}
break;
void
xcsv_data_read(void)
{
- char *buff;
- char *s;
- waypoint *wpt_tmp;
+ char* buff;
+ char* s;
+ waypoint* wpt_tmp;
int linecount = 0;
- queue *elem, *tmp;
- field_map_t *fmp;
- ogue_t *ogp;
- route_head *rte = NULL;
- route_head *trk = NULL;
+ queue* elem, *tmp;
+ field_map_t* fmp;
+ ogue_t* ogp;
+ route_head* rte = NULL;
+ route_head* trk = NULL;
utm_northing = 0;
utm_easting = 0;
utm_zone = 0;
*/
QUEUE_FOR_EACH(&xcsv_file.epilogue, elem, tmp) {
- ogp = (ogue_t *) elem;
+ ogp = (ogue_t*) elem;
if (strncmp(buff, ogp->val, strlen(ogp->val)) == 0) {
buff[0] = '\0';
break;
* off the beginning of buff since there's no index into queue.
*/
while (s) {
- fmp = (field_map_t *) elem;
+ fmp = (field_map_t*) elem;
xcsv_parse_val(s, wpt_tmp, fmp, &trk);
elem = QUEUE_NEXT(elem);
}
static void
-xcsv_resetpathlen(const route_head *head)
+xcsv_resetpathlen(const route_head* head)
{
pathdist = 0;
oldlat = 999;
csv_route = csv_track = NULL;
switch (xcsv_file.datatype) {
case trkdata:
- csv_track = (route_head *) head;
+ csv_track = (route_head*) head;
break;
case rtedata:
- csv_route = (route_head *) head;
+ csv_route = (route_head*) head;
break;
default:
break;
/* (the output meat) */
/*****************************************************************************/
static void
-xcsv_waypt_pr(const waypoint *wpt)
+xcsv_waypt_pr(const waypoint* wpt)
{
char buff[1024];
- char *shortname = NULL;
- char *description = NULL;
- char * anyname = NULL;
- char * write_delimiter;
+ char* shortname = NULL;
+ char* description = NULL;
+ char* anyname = NULL;
+ char* write_delimiter;
int i;
- field_map_t *fmp;
- queue *elem, *tmp;
+ field_map_t* fmp;
+ queue* elem, *tmp;
double latitude, longitude;
int32 utmz;
double utme, utmn;
}
description = shortname;
} else if (description) {
- char *odesc = description;
+ char* odesc = description;
description = xstrdup(odesc);
xfree(odesc);
}
i = 0;
QUEUE_FOR_EACH(xcsv_file.ofield, elem, tmp) {
- char *obuff;
+ char* obuff;
double lat = latitude;
double lon = longitude;
/*
*/
int field_is_unknown = 0;
- fmp = (field_map_t *) elem;
+ fmp = (field_map_t*) elem;
if ((i != 0) && !(fmp->options & OPTIONS_NODELIM)) {
gbfprintf(xcsv_file.xcsvfp, write_delimiter);
writebuff(buff, fmp->printfc, waypt_out_count + atoi(fmp->val));
break;
case XT_CONSTANT: {
- const char *cp = xcsv_get_char_from_constant_table(fmp->val);
+ const char* cp = xcsv_get_char_from_constant_table(fmp->val);
if (cp) {
writebuff(buff, fmp->printfc, cp);
} else {
field_is_unknown = !wpt->sat;
break;
case XT_GPS_FIX: {
- char *fix = NULL;
+ char* fix = NULL;
switch (wpt->fix) {
case fix_unknown:
field_is_unknown = 1;
break;
/* GMSD ************************************************************/
case XT_COUNTRY: {
- garmin_fs_t *gmsd = GMSD_FIND(wpt);
+ garmin_fs_t* gmsd = GMSD_FIND(wpt);
writebuff(buff, fmp->printfc, GMSD_GET(country, ""));
}
break;
case XT_STATE: {
- garmin_fs_t *gmsd = GMSD_FIND(wpt);
+ garmin_fs_t* gmsd = GMSD_FIND(wpt);
writebuff(buff, fmp->printfc, GMSD_GET(state, ""));
}
break;
case XT_CITY: {
- garmin_fs_t *gmsd = GMSD_FIND(wpt);
+ garmin_fs_t* gmsd = GMSD_FIND(wpt);
writebuff(buff, fmp->printfc, GMSD_GET(city, ""));
}
break;
case XT_POSTAL_CODE: {
- garmin_fs_t *gmsd = GMSD_FIND(wpt);
+ garmin_fs_t* gmsd = GMSD_FIND(wpt);
writebuff(buff, fmp->printfc, GMSD_GET(postal_code, ""));
}
break;
case XT_STREET_ADDR: {
- garmin_fs_t *gmsd = GMSD_FIND(wpt);
+ garmin_fs_t* gmsd = GMSD_FIND(wpt);
writebuff(buff, fmp->printfc, GMSD_GET(addr, ""));
}
break;
case XT_PHONE_NR: {
- garmin_fs_t *gmsd = GMSD_FIND(wpt);
+ garmin_fs_t* gmsd = GMSD_FIND(wpt);
writebuff(buff, fmp->printfc, GMSD_GET(phone_nr, ""));
}
break;
case XT_FACILITY: {
- garmin_fs_t *gmsd = GMSD_FIND(wpt);
+ garmin_fs_t* gmsd = GMSD_FIND(wpt);
writebuff(buff, fmp->printfc, GMSD_GET(facility, ""));
}
break;
}
static void
-xcsv_noop(const route_head *wp)
+xcsv_noop(const route_head* wp)
{
/* no-op */
}
void
xcsv_data_write(void)
{
- queue *elem, *tmp;
- ogue_t *ogp;
+ queue* elem, *tmp;
+ ogue_t* ogp;
time_t time;
struct tm tm;
char tbuf[32];
/* output prologue lines, if any. */
QUEUE_FOR_EACH(&xcsv_file.prologue, elem, tmp) {
- char *cout, *ctmp;
- ogp = (ogue_t *) elem;
+ char* cout, *ctmp;
+ ogp = (ogue_t*) elem;
cout = xstrdup((ogp->val) ? ogp->val : "");
/* output epilogue lines, if any. */
QUEUE_FOR_EACH(&xcsv_file.epilogue, elem, tmp) {
- ogp = (ogue_t *) elem;
+ ogp = (ogue_t*) elem;
gbfprintf(xcsv_file.xcsvfp, "%s%s", ogp->val, xcsv_file.record_delimiter);
}
}
/* function prototypes */
-char *
+char*
#ifndef DEBUG_MEM
-csv_stringtrim(const char *string, const char *enclosure, int strip_max);
+csv_stringtrim(const char* string, const char* enclosure, int strip_max);
#else
-CSV_STRINGTRIM(const char *string, const char *enclosure, int strip_max, DEBUG_PARAMS);
+CSV_STRINGTRIM(const char* string, const char* enclosure, int strip_max, DEBUG_PARAMS);
#define csv_stringtrim( s, e,m ) CSV_STRINGTRIM( s, e, m, __FILE__, __LINE__)
#endif
-char *
-csv_lineparse(const char *stringstart, const char *delimited_by, const char *enclosed_in, const int line_no);
+char*
+csv_lineparse(const char* stringstart, const char* delimited_by, const char* enclosed_in, const int line_no);
void
-human_to_dec(const char *instr, double *outlat, double *outlon, int which);
+human_to_dec(const char* instr, double* outlat, double* outlon, int which);
-char *
+char*
#ifndef DEBUG_MEM
-csv_stringclean(const char *string, const char *chararray);
+csv_stringclean(const char* string, const char* chararray);
#else
-CSV_STRINGCLEAN(const char *string, const char *chararray,DEBUG_PARAMS);
+CSV_STRINGCLEAN(const char* string, const char* chararray,DEBUG_PARAMS);
#define csv_stringclean(s,c) CSV_STRINGCLEAN(s,c,__FILE__,__LINE__)
#endif
xcsv_file_init(void);
void
-xcsv_prologue_add(char *);
+xcsv_prologue_add(char*);
void
-xcsv_epilogue_add(char *);
+xcsv_epilogue_add(char*);
void
-xcsv_ifield_add(char *, char *, char *);
+xcsv_ifield_add(char*, char*, char*);
void
-xcsv_ofield_add(char *, char *, char *, int options);
+xcsv_ofield_add(char*, char*, char*, int options);
void
xcsv_destroy_style(void);
-const char *
-xcsv_get_char_from_constant_table(char *key);
+const char*
+xcsv_get_char_from_constant_table(char* key);
/****************************************************************************/
/* types required for various xcsv functions */
#define OPTIONS_OPTIONAL 3
typedef struct field_map {
queue Q;
- char * key;
- char * val;
- char * printfc;
+ char* key;
+ char* val;
+ char* printfc;
int hashed_key;
int options;
} field_map_t;
/* a queuing struct for prologues / epilogues */
typedef struct ogue {
queue Q;
- char * val;
+ char* val;
} ogue_t;
/* something to map config file constants to chars */
typedef struct char_map {
- const char * key;
- const char * chars;
+ const char* key;
+ const char* chars;
} char_map_t;
/*
/* footer lines for writing at the bottom of the file. */
queue epilogue;
- char * field_delimiter; /* comma, quote, etc... */
- char * record_delimiter; /* newline, c/r, etc... */
+ char* field_delimiter; /* comma, quote, etc... */
+ char* record_delimiter; /* newline, c/r, etc... */
- char * badchars; /* characters we never write to output */
+ char* badchars; /* characters we never write to output */
queue ifield; /* input field mapping */
- queue * ofield; /* output field mapping */
+ queue* ofield; /* output field mapping */
int ifield_ct; /* actual # of ifields */
int ofield_ct; /* actual # of ofields */
- gbfile * xcsvfp; /* ptr to current *open* data file */
- char * fname; /* ptr to filename of above. */
+ gbfile* xcsvfp; /* ptr to current *open* data file */
+ char* fname; /* ptr to filename of above. */
- char * description; /* Description for help text */
- char * extension; /* preferred filename extension (for wrappers)*/
+ char* description; /* Description for help text */
+ char* extension; /* preferred filename extension (for wrappers)*/
short_handle mkshort_handle;/* handle for mkshort() */
ff_type type; /* format type for GUI wrappers. */
int verbose_status; /* set by GUI wrappers for status */
int smart_icons;
int smart_names;
- cet_cs_vec_t *charset;
- char *charset_name;
- inifile_t *inifile;
+ cet_cs_vec_t* charset;
+ char* charset_name;
+ inifile_t* inifile;
} global_options;
extern global_options global_opts;
typedef struct {
int is_html;
- char *utfstring;
+ char* utfstring;
} utf_string;
typedef struct {
status_type is_available:2;
time_t exported;
time_t last_found;
- char *placer; /* Placer name */
+ char* placer; /* Placer name */
int placer_id; /* Placer id */
- char *hint; /* all these UTF8, XML entities removed, May be not HTML. */
+ char* hint; /* all these UTF8, XML entities removed, May be not HTML. */
utf_string desc_short;
utf_string desc_long;
} geocache_data ;
typedef struct xml_tag {
- char *tagname;
- char *cdata;
+ char* tagname;
+ char* cdata;
int cdatalen;
- char *parentcdata;
+ char* parentcdata;
int parentcdatalen;
- char **attributes;
- struct xml_tag *parent;
- struct xml_tag *sibling;
- struct xml_tag *child;
+ char** attributes;
+ struct xml_tag* parent;
+ struct xml_tag* sibling;
+ struct xml_tag* child;
} xml_tag ;
-typedef void (*fs_destroy)(void *);
-typedef void (*fs_copy)(void **, void *);
-typedef void (*fs_convert)(void *);
+typedef void (*fs_destroy)(void*);
+typedef void (*fs_copy)(void**, void*);
+typedef void (*fs_convert)(void*);
typedef struct format_specific_data {
long type;
- struct format_specific_data *next;
+ struct format_specific_data* next;
fs_destroy destroy;
fs_copy copy;
} gb_color;
-format_specific_data *fs_chain_copy(format_specific_data *source);
-void fs_chain_destroy(format_specific_data *chain);
-format_specific_data *fs_chain_find(format_specific_data *chain, long type);
-void fs_chain_add(format_specific_data **chain, format_specific_data *data);
+format_specific_data* fs_chain_copy(format_specific_data* source);
+void fs_chain_destroy(format_specific_data* chain);
+format_specific_data* fs_chain_find(format_specific_data* chain, long type);
+void fs_chain_add(format_specific_data** chain, format_specific_data* data);
typedef struct fs_xml {
format_specific_data fs;
- xml_tag *tag;
+ xml_tag* tag;
} fs_xml;
-fs_xml *fs_xml_alloc(long type);
+fs_xml* fs_xml_alloc(long type);
#define FS_GPX 0x67707800L
#define FS_AN1W 0x616e3177L
* Structures and functions for multiple URLs per waypoint.
*/
typedef struct url_link {
- struct url_link *url_next;
- char *url;
- char *url_link_text;
+ struct url_link* url_next;
+ char* url;
+ char* url_link_text;
} url_link;
/*
* minimum length for shortname is 6 characters for NMEA units,
* 8 for Magellan and 10 for Vista. These are only guidelines.
*/
- char *shortname;
+ char* shortname;
/*
* description is typically a human readable description of the
* waypoint. It may be used as a comment field in some receivers.
* These are probably under 40 bytes, but that's only a guideline.
*/
- char *description;
+ char* description;
/*
* notes are relatively long - over 100 characters - prose associated
* with the above. Unlike shortname and description, these are never
* used to compute anything else and are strictly "passed through".
* Few formats support this.
*/
- char *notes;
+ char* notes;
/* This is a bit icky. Multiple waypoint support is an
* afterthought and I don't want to change our data structures.
* We also use an implicit anonymous union here, so these three
* members must match struct url_link...
*/
- struct url_link *url_next;
- char *url;
- char *url_link_text;
+ struct url_link* url_next;
+ char* url;
+ char* url_link_text;
wp_flags wpt_flags;
- const char *icon_descr;
+ const char* icon_descr;
time_t creation_time; /* standardized in UTC/GMT */
int microseconds; /* Optional millionths of a second. */
unsigned char cadence; /* revolutions per minute */
float power; /* watts, as measured by cyclists */
float temperature; /* Degrees celsius */
- const geocache_data *gc_data;
- format_specific_data *fs;
- session_t *session; /* pointer to a session struct */
- void *extra_data; /* Extra data added by, say, a filter. */
+ const geocache_data* gc_data;
+ format_specific_data* fs;
+ session_t* session; /* pointer to a session struct */
+ void* extra_data; /* Extra data added by, say, a filter. */
} waypoint;
typedef struct {
queue Q; /* Link onto parent list. */
queue waypoint_list; /* List of child waypoints */
- char *rte_name;
- char *rte_desc;
- char *rte_url;
+ char* rte_name;
+ char* rte_desc;
+ char* rte_url;
int rte_num;
int rte_waypt_ct; /* # waypoints in waypoint list */
- format_specific_data *fs;
+ format_specific_data* fs;
unsigned short cet_converted; /* strings are converted to UTF8; interesting only for input */
gb_color line_color; /* Optional line color for rendering */
int line_width; /* in pixels (sigh). < 0 is unknown. */
- session_t *session; /* pointer to a session struct */
+ session_t* session; /* pointer to a session struct */
} route_head;
/*
extern posn_status tracking_status;
-typedef void (*ff_init)(char const *);
+typedef void (*ff_init)(char const*);
typedef void (*ff_deinit)(void);
typedef void (*ff_read)(void);
typedef void (*ff_write)(void);
typedef void (*ff_exit)(void);
-typedef void (*ff_writeposn)(waypoint *);
-typedef waypoint * (*ff_readposn)(posn_status *);
+typedef void (*ff_writeposn)(waypoint*);
+typedef waypoint* (*ff_readposn)(posn_status*);
#ifndef DEBUG_MEM
-char * get_option(const char *iarglist, const char *argname);
+char* get_option(const char* iarglist, const char* argname);
#else
#define DEBUG_PARAMS const char *file, const int line
-char *GET_OPTION(const char *iarglist, const char *argname, DEBUG_PARAMS);
+char* GET_OPTION(const char* iarglist, const char* argname, DEBUG_PARAMS);
#define get_option(iarglist, argname) GET_OPTION(iarglist, argname, __FILE__, __LINE__)
#endif
-typedef void (*filter_init)(char const *);
+typedef void (*filter_init)(char const*);
typedef void (*filter_process)(void);
typedef void (*filter_deinit)(void);
typedef void (*filter_exit)(void);
-typedef void (*waypt_cb)(const waypoint *);
-typedef void (*route_hdr)(const route_head *);
-typedef void (*route_trl)(const route_head *);
-void waypt_add(waypoint *);
-waypoint * waypt_dupe(const waypoint *);
-waypoint * waypt_new(void);
-void waypt_del(waypoint *);
-void waypt_free(waypoint *);
+typedef void (*waypt_cb)(const waypoint*);
+typedef void (*route_hdr)(const route_head*);
+typedef void (*route_trl)(const route_head*);
+void waypt_add(waypoint*);
+waypoint* waypt_dupe(const waypoint*);
+waypoint* waypt_new(void);
+void waypt_del(waypoint*);
+void waypt_free(waypoint*);
void waypt_disp_all(waypt_cb);
-void waypt_disp_session(const session_t *se, waypt_cb cb);
-void waypt_init_bounds(bounds *bounds);
-int waypt_bounds_valid(bounds *bounds);
-void waypt_add_to_bounds(bounds *bounds, const waypoint *waypointp);
-void waypt_compute_bounds(bounds *);
+void waypt_disp_session(const session_t* se, waypt_cb cb);
+void waypt_init_bounds(bounds* bounds);
+int waypt_bounds_valid(bounds* bounds);
+void waypt_add_to_bounds(bounds* bounds, const waypoint* waypointp);
+void waypt_compute_bounds(bounds*);
double gcgeodist(const double lat1, const double lon1,
const double lat2, const double lon2);
-void waypt_flush(queue *);
+void waypt_flush(queue*);
void waypt_flush_all(void);
unsigned int waypt_count(void);
void set_waypt_count(unsigned int nc);
-void waypt_add_url(waypoint *wpt, char *link, char *url_link_text);
-void free_gpx_extras(xml_tag * tag);
-void xcsv_setup_internal_style(const char *style_buf);
-void xcsv_read_internal_style(const char *style_buf);
-waypoint * find_waypt_by_name(const char *name);
-void waypt_backup(signed int *count, queue **head_bak);
-void waypt_restore(signed int count, queue *head_bak);
-
-geocache_data *waypt_alloc_gc_data(waypoint *wpt);
-int waypt_empty_gc_data(const waypoint *wpt);
-geocache_type gs_mktype(const char *t);
-geocache_container gs_mkcont(const char *t);
-
-route_head *route_head_alloc(void);
-void route_add(waypoint *);
-void route_add_wpt(route_head *rte, waypoint *wpt);
-void route_del_wpt(route_head *rte, waypoint *wpt);
-void track_add_wpt(route_head *rte, waypoint *wpt);
-void track_del_wpt(route_head *rte, waypoint *wpt);
-void route_add_head(route_head *rte);
-void route_del_head(route_head *rte);
-void route_reverse(const route_head *rte_hd);
-waypoint * route_find_waypt_by_name(route_head *rh, const char *name);
-void track_add_head(route_head *rte);
-void track_del_head(route_head *rte);
-void track_insert_head(route_head *rte, route_head *predecessor);
-void route_disp(const route_head *rte, waypt_cb);
+void waypt_add_url(waypoint* wpt, char* link, char* url_link_text);
+void free_gpx_extras(xml_tag* tag);
+void xcsv_setup_internal_style(const char* style_buf);
+void xcsv_read_internal_style(const char* style_buf);
+waypoint* find_waypt_by_name(const char* name);
+void waypt_backup(signed int* count, queue** head_bak);
+void waypt_restore(signed int count, queue* head_bak);
+
+geocache_data* waypt_alloc_gc_data(waypoint* wpt);
+int waypt_empty_gc_data(const waypoint* wpt);
+geocache_type gs_mktype(const char* t);
+geocache_container gs_mkcont(const char* t);
+
+route_head* route_head_alloc(void);
+void route_add(waypoint*);
+void route_add_wpt(route_head* rte, waypoint* wpt);
+void route_del_wpt(route_head* rte, waypoint* wpt);
+void track_add_wpt(route_head* rte, waypoint* wpt);
+void track_del_wpt(route_head* rte, waypoint* wpt);
+void route_add_head(route_head* rte);
+void route_del_head(route_head* rte);
+void route_reverse(const route_head* rte_hd);
+waypoint* route_find_waypt_by_name(route_head* rh, const char* name);
+void track_add_head(route_head* rte);
+void track_del_head(route_head* rte);
+void track_insert_head(route_head* rte, route_head* predecessor);
+void route_disp(const route_head* rte, waypt_cb);
void route_disp_all(route_hdr, route_trl, waypt_cb);
void track_disp_all(route_hdr, route_trl, waypt_cb);
-void route_disp_session(const session_t *se, route_hdr rh, route_trl rt, waypt_cb wc);
-void track_disp_session(const session_t *se, route_hdr rh, route_trl rt, waypt_cb wc);
-void route_flush(queue *);
+void route_disp_session(const session_t* se, route_hdr rh, route_trl rt, waypt_cb wc);
+void track_disp_session(const session_t* se, route_hdr rh, route_trl rt, waypt_cb wc);
+void route_flush(queue*);
void route_flush_all(void);
void route_flush_all_routes(void);
void route_flush_all_tracks(void);
-route_head * route_find_route_by_name(const char *name);
-route_head * route_find_track_by_name(const char *name);
+route_head* route_find_route_by_name(const char* name);
+route_head* route_find_track_by_name(const char* name);
unsigned int route_waypt_count(void);
unsigned int route_count(void);
unsigned int track_waypt_count(void);
unsigned int track_count(void);
-void route_copy(int *dst_count, int *dst_wpt_count, queue **dst, queue *src);
-void route_backup(signed int *count, queue **head_bak);
-void route_restore(queue *head_bak);
-void route_append(queue *src);
-void track_backup(signed int *count, queue **head_bak);
-void track_restore(queue *head_bak);
-void track_append(queue *src);
-void route_flush(queue *head);
-void track_recompute(const route_head *trk, computed_trkdata **);
+void route_copy(int* dst_count, int* dst_wpt_count, queue** dst, queue* src);
+void route_backup(signed int* count, queue** head_bak);
+void route_restore(queue* head_bak);
+void route_append(queue* src);
+void track_backup(signed int* count, queue** head_bak);
+void track_restore(queue* head_bak);
+void track_append(queue* src);
+void route_flush(queue* head);
+void track_recompute(const route_head* trk, computed_trkdata**);
/*
* All shortname functions take a shortname handle as the first arg.
#define PRIME 37
typedef struct {
unsigned int target_len;
- char *badchars;
- char *goodchars;
- char *defname;
+ char* badchars;
+ char* goodchars;
+ char* defname;
queue namelist[PRIME];
/* Various internal flags at end to allow alignment flexibility. */
typedef mkshort_handle_imp* short_handle;
#ifndef DEBUG_MEM
-char *mkshort(short_handle, const char *);
+char* mkshort(short_handle, const char*);
short_handle mkshort_new_handle(void);
#else
-char *MKSHORT(short_handle, const char *, DEBUG_PARAMS);
-void *MKSHORT_NEW_HANDLE(DEBUG_PARAMS);
+char* MKSHORT(short_handle, const char*, DEBUG_PARAMS);
+void* MKSHORT_NEW_HANDLE(DEBUG_PARAMS);
#define mkshort( a, b) MKSHORT(a,b,__FILE__, __LINE__)
#define mkshort_new_handle() MKSHORT_NEW_HANDLE(__FILE__,__LINE__)
#endif
-char *mkshort_from_wpt(short_handle h, const waypoint *wpt);
-void mkshort_del_handle(short_handle *h);
+char* mkshort_from_wpt(short_handle h, const waypoint* wpt);
+void mkshort_del_handle(short_handle* h);
void setshort_length(short_handle, int n);
-void setshort_badchars(short_handle, const char *);
-void setshort_goodchars(short_handle, const char *);
+void setshort_badchars(short_handle, const char*);
+void setshort_goodchars(short_handle, const char*);
void setshort_mustupper(short_handle, int n);
void setshort_mustuniq(short_handle, int n);
void setshort_whitespace_ok(short_handle, int n);
void setshort_repeating_whitespace_ok(short_handle, int n);
-void setshort_defname(short_handle, const char *s);
+void setshort_defname(short_handle, const char* s);
void setshort_is_utf8(short_handle h, const int is_utf8);
/*
*/
#define VMFL_NOZERO (1 << 0)
typedef struct vmem {
- char *mem; /* visible memory object */
+ char* mem; /* visible memory object */
size_t size; /* allocated size of object */
} vmem_t;
vmem_t vmem_alloc(size_t, int flags);
#define ARG_TERMINATOR {0, 0, 0, 0, 0, ARG_NOMINMAX}
typedef struct arglist {
- const char *argstring;
- char **argval;
- const char *helpstring;
- const char *defaultvalue;
+ const char* argstring;
+ char** argval;
+ const char* helpstring;
+ const char* defaultvalue;
const gbuint32 argtype;
- const char *minvalue; /* minimum value for numeric options */
- const char *maxvalue; /* maximum value for numeric options */
- char *argvalptr; /* !!! internal helper. Not used in definitions !!! */
+ const char* minvalue; /* minimum value for numeric options */
+ const char* maxvalue; /* maximum value for numeric options */
+ char* argvalptr; /* !!! internal helper. Not used in definitions !!! */
} arglist_t;
typedef enum {
ff_read read;
ff_write write;
ff_exit exit;
- arglist_t *args;
- const char *encode;
+ arglist_t* args;
+ const char* encode;
int fixed_encode;
position_ops_t position_ops;
- const char *name; /* dyn. initialized by find_vec */
+ const char* name; /* dyn. initialized by find_vec */
} ff_vecs_t;
typedef struct style_vecs {
- const char *name;
- const char *style_buf;
+ const char* name;
+ const char* style_buf;
} style_vecs_t;
extern style_vecs_t style_list[];
void waypt_init(void);
void route_init(void);
-void waypt_disp(const waypoint *);
+void waypt_disp(const waypoint*);
void waypt_status_disp(int total_ct, int myct);
-double waypt_time(const waypoint *wpt);
-double waypt_speed(const waypoint *A, const waypoint *B);
-double waypt_speed_ex(const waypoint *A, const waypoint *B);
-double waypt_course(const waypoint *A, const waypoint *B);
-double waypt_distance(const waypoint *A, const waypoint *B);
-double waypt_distance_ex(const waypoint *A, const waypoint *B);
-
-NORETURN fatal(const char *, ...) PRINTFLIKE(1, 2);
-void is_fatal(const int condition, const char *, ...) PRINTFLIKE(2, 3);
-void warning(const char *, ...) PRINTFLIKE(1, 2);
-
-ff_vecs_t *find_vec(char * const, char **);
-void assign_option(const char *vecname, arglist_t *ap, const char *val);
-void disp_vec_options(const char *vecname, arglist_t *ap);
+double waypt_time(const waypoint* wpt);
+double waypt_speed(const waypoint* A, const waypoint* B);
+double waypt_speed_ex(const waypoint* A, const waypoint* B);
+double waypt_course(const waypoint* A, const waypoint* B);
+double waypt_distance(const waypoint* A, const waypoint* B);
+double waypt_distance_ex(const waypoint* A, const waypoint* B);
+
+NORETURN fatal(const char*, ...) PRINTFLIKE(1, 2);
+void is_fatal(const int condition, const char*, ...) PRINTFLIKE(2, 3);
+void warning(const char*, ...) PRINTFLIKE(1, 2);
+
+ff_vecs_t* find_vec(char* const, char**);
+void assign_option(const char* vecname, arglist_t* ap, const char* val);
+void disp_vec_options(const char* vecname, arglist_t* ap);
void disp_vecs(void);
-void disp_vec(const char *vecname);
+void disp_vec(const char* vecname);
void init_vecs(void);
void exit_vecs(void);
void disp_formats(int version);
-const char * name_option(long type);
+const char* name_option(long type);
void printposn(const double c, int is_lat);
#ifndef DEBUG_MEM
-void *xcalloc(size_t nmemb, size_t size);
-void *xmalloc(size_t size);
-void *xrealloc(void *p, size_t s);
-void xfree(void *mem);
-char *xstrdup(const char *s);
-char *xstrndup(const char *s, size_t n);
-char *xstrndupt(const char *s, size_t n);
-char *xstrappend(char *src, const char *addon);
+void* xcalloc(size_t nmemb, size_t size);
+void* xmalloc(size_t size);
+void* xrealloc(void* p, size_t s);
+void xfree(void* mem);
+char* xstrdup(const char* s);
+char* xstrndup(const char* s, size_t n);
+char* xstrndupt(const char* s, size_t n);
+char* xstrappend(char* src, const char* addon);
#define xxcalloc(nmemb, size, file, line) xcalloc(nmemb, size)
#define xxmalloc(size, file, line) xmalloc(size)
#define xxrealloc(p, s, file, line) xrealloc(p,s)
#define xxstrdup(s, file, line) xstrdup(s)
#define xxstrappend(src, addon, file, line) xstrappend(src, addon)
#else /* DEBUG_MEM */
-void *XCALLOC(size_t nmemb, size_t size, DEBUG_PARAMS);
-void *XMALLOC(size_t size, DEBUG_PARAMS);
-void *XREALLOC(void *p, size_t s, DEBUG_PARAMS);
-void XFREE(void *mem, DEBUG_PARAMS);
-char *XSTRDUP(const char *s, DEBUG_PARAMS);
-char *XSTRNDUP(const char *src, size_t size, DEBUG_PARAMS);
-char *XSTRNDUPT(const char *src, size_t size, DEBUG_PARAMS);
-char *XSTRAPPEND(char *src, const char *addon, DEBUG_PARAMS);
+void* XCALLOC(size_t nmemb, size_t size, DEBUG_PARAMS);
+void* XMALLOC(size_t size, DEBUG_PARAMS);
+void* XREALLOC(void* p, size_t s, DEBUG_PARAMS);
+void XFREE(void* mem, DEBUG_PARAMS);
+char* XSTRDUP(const char* s, DEBUG_PARAMS);
+char* XSTRNDUP(const char* src, size_t size, DEBUG_PARAMS);
+char* XSTRNDUPT(const char* src, size_t size, DEBUG_PARAMS);
+char* XSTRAPPEND(char* src, const char* addon, DEBUG_PARAMS);
void debug_mem_open();
-void debug_mem_output(char *format, ...);
+void debug_mem_output(char* format, ...);
void debug_mem_close();
#define xcalloc(nmemb, size) XCALLOC(nmemb, size, __FILE__, __LINE__)
#define xmalloc(size) XMALLOC(size, __FILE__, __LINE__)
#define xxstrappend XSTRAPPEND
#endif /* DEBUG_MEM */
-FILE *xfopen(const char *fname, const char *type, const char *errtxt);
-void xfprintf(const char *errtxt, FILE *stream, const char *format, ...);
-void xfputs(const char *errtxt, const char *s, FILE *stream);
-
-int case_ignore_strcmp(const char *s1, const char *s2);
-int case_ignore_strncmp(const char *s1, const char *s2, int n);
-int str_match(const char *str, const char *match);
-int case_ignore_str_match(const char *str, const char *match);
-char * strenquote(const char *str, const char quot_char);
-
-char *strsub(const char *s, const char *search, const char *replace);
-char *gstrsub(const char *s, const char *search, const char *replace);
-char *xstrrstr(const char *s1, const char *s2);
-void rtrim(char *s);
-char * lrtrim(char *s);
-int xasprintf(char **strp, const char *fmt, ...);
-int xvasprintf(char **strp, const char *fmt, va_list ap);
-char *strupper(char *src);
-char *strlower(char *src);
+FILE* xfopen(const char* fname, const char* type, const char* errtxt);
+void xfprintf(const char* errtxt, FILE* stream, const char* format, ...);
+void xfputs(const char* errtxt, const char* s, FILE* stream);
+
+int case_ignore_strcmp(const char* s1, const char* s2);
+int case_ignore_strncmp(const char* s1, const char* s2, int n);
+int str_match(const char* str, const char* match);
+int case_ignore_str_match(const char* str, const char* match);
+char* strenquote(const char* str, const char quot_char);
+
+char* strsub(const char* s, const char* search, const char* replace);
+char* gstrsub(const char* s, const char* search, const char* replace);
+char* xstrrstr(const char* s1, const char* s2);
+void rtrim(char* s);
+char* lrtrim(char* s);
+int xasprintf(char** strp, const char* fmt, ...);
+int xvasprintf(char** strp, const char* fmt, va_list ap);
+char* strupper(char* src);
+char* strlower(char* src);
signed int get_tz_offset(void);
-time_t mklocaltime(struct tm *t);
-time_t mkgmtime(struct tm *t);
+time_t mklocaltime(struct tm* t);
+time_t mkgmtime(struct tm* t);
time_t current_time(void);
-void dotnet_time_to_time_t(double dotnet, time_t *t, int *ms);
-signed int month_lookup(const char *m);
-const char *get_cache_icon(const waypoint *waypointp);
-const char *gs_get_cachetype(geocache_type t);
-const char *gs_get_container(geocache_container t);
-char * xml_entitize(const char * str);
-char * html_entitize(const char * str);
-char * strip_html(const utf_string*);
-char * strip_nastyhtml(const char * in);
-char * convert_human_date_format(const char *human_datef); /* "MM,YYYY,DD" -> "%m,%Y,%d" */
-char * convert_human_time_format(const char *human_timef); /* "HH+mm+ss" -> "%H+%M+%S" */
-char * pretty_deg_format(double lat, double lon, char fmt, const char *sep, int html); /* decimal -> dd.dddd or dd mm.mmm or dd mm ss */
-
-char * get_filename(const char *fname); /* extract the filename portion */
+void dotnet_time_to_time_t(double dotnet, time_t* t, int* ms);
+signed int month_lookup(const char* m);
+const char* get_cache_icon(const waypoint* waypointp);
+const char* gs_get_cachetype(geocache_type t);
+const char* gs_get_container(geocache_container t);
+char* xml_entitize(const char* str);
+char* html_entitize(const char* str);
+char* strip_html(const utf_string*);
+char* strip_nastyhtml(const char* in);
+char* convert_human_date_format(const char* human_datef); /* "MM,YYYY,DD" -> "%m,%Y,%d" */
+char* convert_human_time_format(const char* human_timef); /* "HH+mm+ss" -> "%H+%M+%S" */
+char* pretty_deg_format(double lat, double lon, char fmt, const char* sep, int html); /* decimal -> dd.dddd or dd mm.mmm or dd mm ss */
+
+char* get_filename(const char* fname); /* extract the filename portion */
/*
* Character encoding transformations.
#define str_iso8859_1_to_utf8(str) cet_str_iso8859_1_to_utf8((str))
/* this lives in gpx.c */
-time_t xml_parse_time(const char *cdatastr, int * microsecs);
+time_t xml_parse_time(const char* cdatastr, int* microsecs);
-xml_tag *xml_findfirst(xml_tag *root, const char *tagname);
-xml_tag *xml_findnext(xml_tag *root, xml_tag *cur, const char *tagname);
-char *xml_attribute(xml_tag *tag, const char *attrname);
+xml_tag* xml_findfirst(xml_tag* root, const char* tagname);
+xml_tag* xml_findnext(xml_tag* root, xml_tag* cur, const char* tagname);
+char* xml_attribute(xml_tag* tag, const char* attrname);
-char * rot13(const char *str);
+char* rot13(const char* str);
/*
* PalmOS records like fixed-point numbers, which should be rounded
* Protypes for Endianness helpers.
*/
-signed int be_read16(const void *p);
-unsigned int be_readu16(const void *p);
-signed int be_read32(const void *p);
-signed int le_read16(const void *p);
-unsigned int le_readu16(const void *p);
-signed int le_read32(const void *p);
-unsigned int le_readu32(const void *p);
-void le_read64(void *dest, const void *src);
-void be_write16(void *pp, const unsigned i);
-void be_write32(void *pp, const unsigned i);
-void le_write16(void *pp, const unsigned i);
-void le_write32(void *pp, const unsigned i);
+signed int be_read16(const void* p);
+unsigned int be_readu16(const void* p);
+signed int be_read32(const void* p);
+signed int le_read16(const void* p);
+unsigned int le_readu16(const void* p);
+signed int le_read32(const void* p);
+unsigned int le_readu32(const void* p);
+void le_read64(void* dest, const void* src);
+void be_write16(void* pp, const unsigned i);
+void be_write32(void* pp, const unsigned i);
+void le_write16(void* pp, const unsigned i);
+void le_write32(void* pp, const unsigned i);
double endian_read_double(const void* ptr, int read_le);
float endian_read_float(const void* ptr, int read_le);
void endian_write_double(void* ptr, double d, int write_le);
void endian_write_float(void* ptr, float f, int write_le);
-float be_read_float(void *p);
-double be_read_double(void *p);
-void be_write_float(void *pp, float d);
-void be_write_double(void *pp, double d);
+float be_read_float(void* p);
+double be_read_double(void* p);
+void be_write_float(void* pp, float d);
+void be_write_double(void* pp, double d);
-float le_read_float(const void *p);
-double le_read_double(const void *p);
-void le_write_float(void *ptr, float f);
-void le_write_double(void *p, double d);
+float le_read_float(const void* p);
+double le_read_double(const void* p);
+void le_write_float(void* ptr, float f);
+void le_write_double(void* p, double d);
#define pdb_write_float be_write_float
#define pdb_read_float be_read_float
/* bit manipulation functions (util.c) */
-char gb_getbit(const void *buf, const gbuint32 nr);
-void gb_setbit(void *buf, const gbuint32 nr);
+char gb_getbit(const void* buf, const gbuint32 nr);
+void gb_setbit(void* buf, const gbuint32 nr);
-void *gb_int2ptr(const int i);
-int gb_ptr2int(const void *p);
+void* gb_int2ptr(const int i);
+int gb_ptr2int(const void* p);
/*
* From parse.c
*/
-int parse_coordinates(const char *str, int datum, const grid_type grid,
- double *latitude, double *longitude, const char *module);
-int parse_distance(const char *str, double *val, double scale, const char *module);
-int parse_speed(const char *str, double *val, const double scale, const char *module);
-time_t parse_date(const char *str, const char *format, const char *module);
+int parse_coordinates(const char* str, int datum, const grid_type grid,
+ double* latitude, double* longitude, const char* module);
+int parse_distance(const char* str, double* val, double scale, const char* module);
+int parse_speed(const char* str, double* val, const double scale, const char* module);
+time_t parse_date(const char* str, const char* format, const char* module);
/*
* From util_crc.c
*/
-unsigned long get_crc32(const void * data, int datalen);
-unsigned long get_crc32_s(const void * data);
+unsigned long get_crc32(const void* data, int datalen);
+unsigned long get_crc32_s(const void* data);
/*
* From units.c
} fmt_units;
int fmt_setunits(fmt_units);
-double fmt_distance(const double, char **tag);
-double fmt_altitude(const double, char **tag);
-double fmt_speed(const double, char **tag);
+double fmt_distance(const double, char** tag);
+double fmt_altitude(const double, char** tag);
+double fmt_speed(const double, char** tag);
/*
* From gbsleep.c
/*
* From nmea.c
*/
-int nmea_cksum(const char *const buf);
+int nmea_cksum(const char* const buf);
/*
* Color helpers.
*/
-int color_to_bbggrr(const char *cname);
+int color_to_bbggrr(const char* cname);
/*
* A constant for unknown altitude. It's tempting to just use zero
#define DELBIN_MAX_UNITS 32
static struct {
unsigned int unit_number;
- const char *unit_serial_number;
- const char *unit_name;
+ const char* unit_serial_number;
+ const char* unit_name;
} delbin_unit_info[DELBIN_MAX_UNITS];
static int n_delbin_units;
#define sizeofarray(x) (sizeof(x) / sizeof(x[0]))
-static char *opt_getposn = NULL;
-static char *opt_logs = NULL;
-static char *opt_long_notes = NULL;
-static char *opt_nuke_wpt = NULL;
-static char *opt_nuke_trk = NULL;
-static char *opt_nuke_rte = NULL;
+static char* opt_getposn = NULL;
+static char* opt_logs = NULL;
+static char* opt_long_notes = NULL;
+static char* opt_nuke_wpt = NULL;
+static char* opt_nuke_trk = NULL;
+static char* opt_nuke_rte = NULL;
/* If true, Order hint to match Cache Register and Topo 7 */
-static char *opt_hint_at_end = NULL;
-static char *opt_gcsym = NULL;
+static char* opt_hint_at_end = NULL;
+static char* opt_gcsym = NULL;
static arglist_t delbin_args[] = {
}
if (global_opts.debug_level >= DBGLVL_H) {
unsigned j;
- const gbuint8* p = buf;
+ const gbuint8* p = (const gbuint8*) buf;
debug_out_time("pcktrd");
for (j = 0; j < n; j++) {
unsigned n;
if (global_opts.debug_level >= DBGLVL_H) {
unsigned j;
- const gbuint8* p = buf;
+ const gbuint8* p = (const gbuint8*) buf;
debug_out_time("pcktwr");
for (j = 0; j < size; j++) {
message_init(message_t* m)
{
m->capacity = 100;
- m->buf = xmalloc(m->capacity);
+ m->buf = (gbuint8*)xmalloc(m->capacity);
m->data = m->buf + 2 + 8;
}
{
m->size = size;
m->capacity = 2 + 8 + size + 4;
- m->buf = xmalloc(m->capacity);
+ m->buf = (gbuint8*)xmalloc(m->capacity);
m->data = m->buf + 2 + 8;
}
if (m->capacity < 2 + 8 + size + 4) {
m->capacity = 2 + 8 + size + 4;
xfree(m->buf);
- m->buf = xmalloc(m->capacity);
+ m->buf = (gbuint8*)xmalloc(m->capacity);
m->data = m->buf + 2 + 8;
}
}
{
message_t ack;
char* p1;
- const char* p2 = m->data;
+ const char* p2 = (const char*) m->data;
switch (id) {
case MSG_ACK:
case MSG_NACK:
return;
}
message_init_size(&ack, 4);
- p1 = ack.data;
+ p1 = (char*) ack.data;
// ack payload is id and body checksum of acked message
le_write16(p1, id);
p1[2] = p2[m->size];
break;
}
if (id == MSG_ERROR) {
- const gbuint8* p = m->data;
+ const gbuint8* p = (const gbuint8*) m->data;
fatal(MYNAME ": device error %u: \"%s\"\n", *p, p + 1);
}
message_ack(id, m);
{
int success = 1;
unsigned array_max = 100;
- message_t* a = xmalloc(array_max * sizeof(message_t));
+ message_t* a = (message_t*) xmalloc(array_max * sizeof(message_t));
unsigned i = 0;
unsigned id;
if (global_opts.debug_level >= DBGLVL_M) {
if (i == array_max) {
message_t* old_a = a;
array_max += array_max;
- a = xmalloc(array_max * sizeof(message_t));
+ a = (message_t*) xmalloc(array_max * sizeof(message_t));
memcpy(a, old_a, i * sizeof(message_t));
xfree(old_a);
}
static struct {
unsigned msg_id;
message_t msg;
-} *batch_array;
+}* batch_array;
static unsigned batch_array_max;
static unsigned batch_array_i;
decode_waypoint(const void* data)
{
waypoint* wp = waypt_new();
- const msg_waypoint_t* p = data;
+ const msg_waypoint_t* p = (const msg_waypoint_t*)data;
const char* s;
float f;
warning(MYNAME ": read waypoint '%s'\n", wp->description);
}
} else if (wp && id == MSG_WAYPOINT_NOTE_OUT) {
- const msg_waypoint_note_t* p = msg_array[i].data;
+ const msg_waypoint_note_t* p = (const msg_waypoint_note_t*) msg_array[i].data;
const char* s = p->name + p->name_size;
unsigned nn = le_readu16(s);
if (notes_max < notes_i + nn) {
do {
notes_max += notes_max;
} while (notes_max < notes_i + nn);
- wp->notes = xmalloc(notes_max);
+ wp->notes = (char*) xmalloc(notes_max);
if (old) {
memcpy(wp->notes, old, notes_i);
xfree(old);
}
gbfputc(0, fd);
*notes_size = fd->memlen;
- *notes = xmalloc(*notes_size);
+ *notes = (char*) xmalloc(*notes_size);
memcpy(*notes, fd->handle.mem, *notes_size);
gbfclose(fd);
}
unsigned n = bytes_per_msg;
msg_waypoint_note_t* p;
message_init_size(&m, 2 + 2 + 1 + name_size + 2 + bytes_per_msg);
- p = m.data;
+ p = (msg_waypoint_note_t*) m.data;
le_write16(p->index, i++);
le_write16(p->total, msg_count);
p->name_size = name_size;
msg_delete_t* p;
message_init_size(&m, MSG_DELETE_SIZE);
- p = m.data;
+ p = (msg_delete_t*) m.data;
p->type = type;
p->mode = nuke_mode_all;
p->location = nuke_dest_internal;
name_size = 255;
}
message_init_size(&m, 31 + name_size + notes_size);
- p = m.data;
+ p = (msg_waypoint_t*) m.data;
waypoint_i++;
le_write32(p->total, waypoint_n);
static void
decode_track_point(const void* data, unsigned* wp_array_i, unsigned max_point)
{
- const msg_track_point_t* p = data;
+ const msg_track_point_t* p = (const msg_track_point_t*) data;
const unsigned n = p->number;
unsigned i;
unsigned j = *wp_array_i;
fatal(MYNAME ": reading track '%s' failed (missing track header)\n", track->rte_name);
}
// process track messages
- p = msg_array[0].data;
+ p = (const msg_track_header_t*) msg_array[0].data;
if (le_readu16(p->comment_size)) {
track->rte_desc = xstrdup(p->comment);
}
track->line_color.bbggrr = track_color(p->color[0]);
n_point = le_readu32(p->total_points);
- wp_array = xcalloc(n_point, sizeof(*wp_array));
+ wp_array = (waypoint**) xcalloc(n_point, sizeof(*wp_array));
message_free(&msg_array[0]);
for (i = 1; i < msg_array_n; i++) {
unsigned id = message_get_id(&msg_array[i]);
message_write(MSG_BREAK, &m);
}
message_free(&m);
- track_array = xcalloc(total, sizeof(*track_array));
+ track_array = (route_head**) xcalloc(total, sizeof(*track_array));
for (i = 0; i < msg_array_n; i++) {
unsigned id = message_get_id(&msg_array[i]);
if (id == MSG_TRACK_HEADER_OUT) {
- const msg_track_header_t* p = msg_array[i].data;
+ const msg_track_header_t* p = (msg_track_header_t*) msg_array[i].data;
if (le_readu32(p->total_points)) {
track_array[i] = route_head_alloc();
track_array[i]->rte_name = xstrdup(p->name);
if (j == 0) {
message_init_size(&m, 9 + 23 * pt_per_msg);
- p = m.data;
+ p =(msg_track_point_t*) m.data;
le_write32(p->total, waypoint_n);
le_write32(p->index, i + 1);
}
waypoint_i = 0;
waypoint_n = track->rte_waypt_ct;
if (waypoint_n) {
- wp_array = xmalloc(waypoint_n * sizeof(*wp_array));
+ wp_array = (waypoint**) xmalloc(waypoint_n * sizeof(*wp_array));
}
}
comment_size = strlen(track->rte_desc) + 1;
}
message_init_size(&m, sizeof(msg_track_header_in_t) - 1 + comment_size);
- p = m.data;
+ p = (msg_track_header_in_t*) m.data;
memset(p->name, 0, sizeof(p->name));
if (track->rte_name) {
strncpy(p->name, track->rte_name, sizeof(p->name) - 1);
static void
decode_route_shape(const void* data, unsigned* wp_array_i)
{
- const msg_route_shape_t* p = data;
+ const msg_route_shape_t* p = (msg_route_shape_t*) data;
const unsigned n = p->number;
unsigned i;
unsigned j = *wp_array_i;
static waypoint*
decode_route_point(const void* data)
{
- const msg_route_point_t* p = data;
+ const msg_route_point_t* p = (const msg_route_point_t*) data;
const char* s = NULL;
gbfile* fd = gbfopen(NULL, "w", MYNAME);
waypoint* wp = waypt_new();
}
if (fd->memlen) {
gbfputc(0, fd);
- wp->notes = xmalloc(fd->memlen);
+ wp->notes = (char*) xmalloc(fd->memlen);
memcpy(wp->notes, fd->handle.mem, fd->memlen);
}
gbfclose(fd);
if (msg_array_n == 0 || message_get_id(&msg_array[0]) != MSG_ROUTE_HEADER_OUT) {
fatal(MYNAME ": missing route header\n");
}
- p = msg_array[0].data;
+ p = (const msg_route_header_t*) msg_array[0].data;
route_total = le_readu32(p->total_route_point);
shape_total = le_readu32(p->total_shape_point);
total = route_total + shape_total;
- wp_array = xcalloc(total, sizeof(*wp_array));
+ wp_array = (waypoint**) xcalloc(total, sizeof(*wp_array));
if (global_opts.debug_level >= DBGLVL_L) {
warning(MYNAME ": route '%s' %u points, %u shape points\n",
route->rte_name, route_total, shape_total);
message_write(MSG_BREAK, &m);
}
message_free(&m);
- route_array = xcalloc(total, sizeof(*route_array));
+ route_array = (route_head**) xcalloc(total, sizeof(*route_array));
for (i = 0; i < msg_array_n; i++) {
unsigned id = message_get_id(&msg_array[i]);
if (id == MSG_ROUTE_HEADER_OUT) {
do {
if (j == 0) {
message_init_size(&m, 10 + 8 * pt_per_msg);
- p = m.data;
+ p = (msg_route_shape_t*) m.data;
le_write32(p->total, n);
le_write32(p->index, i + 1);
p->reserved = 0;
char* s;
message_init_size(&m, sizeof(msg_route_point_t) + 1 + 1 + 4);
- p = m.data;
+ p = (msg_route_point_t*) m.data;
memset(m.data, 0, m.size);
route_point_i++;
shape_n = shape_point_counts[route_point_i];
shape_point_n = 0;
waypoint_n = track->rte_waypt_ct;
if (waypoint_n) {
- wp_array = xmalloc(waypoint_n * sizeof(*wp_array));
- shape_point_counts = xcalloc(waypoint_n, sizeof(*shape_point_counts));
+ wp_array = (waypoint**) xmalloc(waypoint_n * sizeof(*wp_array));
+ shape_point_counts = (unsigned int*) xcalloc(waypoint_n, sizeof(*shape_point_counts));
}
}
return;
}
message_init_size(&m, sizeof(msg_route_header_in_t));
- p = m.data;
+ p = (msg_route_header_in_t*) m.data;
memset(p->name, 0, sizeof(p->name));
if (route->rte_name) {
strncpy(p->name, route->rte_name, sizeof(p->name) - 1);
decode_navmsg(const void* data)
{
waypoint* wp = waypt_new();
- const msg_navigation_t* p = data;
+ const msg_navigation_t* p = (const msg_navigation_t*) data;
struct tm t;
t.tm_year = le_readu16(p->year) - 1900;
wp = decode_navmsg(m.data);
if (wp->fix > fix_none &&
message_read_1(MSG_SATELLITE_INFO, &m) == MSG_SATELLITE_INFO) {
- const msg_satellite_t* p = m.data;
+ const msg_satellite_t* p = (const msg_satellite_t*) m.data;
wp->hdop = le_readu16(p->hdop);
wp->hdop /= 100;
wp->vdop = le_readu16(p->vdop);
}
static void
-delbin_rw_init(const char *fname)
+delbin_rw_init(const char* fname)
{
message_t m;
char buf[256];
m.size = 0;
message_write(MSG_VERSION, &m);
if (message_read(MSG_VERSION, &m)) {
- const msg_version_t* p = m.data;
+ const msg_version_t* p = (const msg_version_t*) m.data;
if (global_opts.debug_level >= DBGLVL_L) {
warning(MYNAME ": device %s %s\n", p->product, p->firmware);
}
message_init_size(&m, 0);
message_write(MSG_CAPABILITIES, &m);
if (message_read(MSG_CAPABILITIES, &m)) {
- const msg_capabilities_t* p = m.data;
+ const msg_capabilities_t* p = (const msg_capabilities_t*) m.data;
device_max_waypoint = le_readu32(p->max_waypoints);
}
message_free(&m);
fatal(MYNAME ": createAsyncEventSource failed 0x%x\n", (int)ir);
}
delbin_os_packet_size = 64;
- report_buf = xmalloc(delbin_os_packet_size);
+ report_buf = (char*)xmalloc(delbin_os_packet_size);
for (i = sizeofarray(packet_array); i--;) {
- packet_array[i] = xmalloc(delbin_os_packet_size);
+ packet_array[i] = (char*)xmalloc(delbin_os_packet_size);
}
ir = (*device)->setInterruptReportHandlerCallback(
device, report_buf, delbin_os_packet_size, interrupt_report_cb, NULL, NULL);
unsigned int dummy3;
} gpl_point_t;
-static gbfile *gplfile_in;
-static gbfile *gplfile_out;
+static gbfile* gplfile_in;
+static gbfile* gplfile_out;
static void
-gpl_rd_init(const char *fname)
+gpl_rd_init(const char* fname)
{
gplfile_in = gbfopen_le(fname, "rb", MYNAME);
if (sizeof(struct gpl_point) != 56) {
static void
gpl_read(void)
{
- waypoint *wpt_tmp;
- route_head *track_head;
+ waypoint* wpt_tmp;
+ route_head* track_head;
gpl_point_t gp;
double alt_feet;
}
static void
-gpl_wr_init(const char *fname)
+gpl_wr_init(const char* fname)
{
gplfile_out = gbfopen_le(fname, "wb", MYNAME);
}
}
static void
-gpl_trackpt(const waypoint *wpt)
+gpl_trackpt(const waypoint* wpt)
{
double alt_feet = METERS_TO_FEET(wpt->altitude);
int status = 3;
ff_vecs_t gpl_vecs = {
ff_type_file,
- { ff_cap_none, ff_cap_read | ff_cap_write, ff_cap_none },
+ { ff_cap_none, (ff_cap)(ff_cap_read | ff_cap_write), ff_cap_none },
gpl_rd_init,
gpl_wr_init,
gpl_rd_deinit,
ARG_TERMINATOR
};
-static gbfile *fin, *fout;
+static gbfile* fin, *fout;
static gpsdata_type data_type;
/* READER */
/*-----------------------------------------------------------------------------*/
-static garmin_fs_t *
-gmsd_init(waypoint *wpt)
+static garmin_fs_t*
+gmsd_init(waypoint* wpt)
{
- garmin_fs_t *gmsd = GMSD_FIND(wpt);
+ garmin_fs_t* gmsd = GMSD_FIND(wpt);
if (gmsd == NULL) {
gmsd = garmin_fs_alloc(-1);
- fs_chain_add(&wpt->fs, (format_specific_data *) gmsd);
+ fs_chain_add(&wpt->fs, (format_specific_data*) gmsd);
}
return gmsd;
}
-static char *
+static char*
read_wcstr(const int discard)
{
- gbint16 *buff = NULL, c;
+ gbint16* buff = NULL, c;
int size = 0, pos = 0;
while (gbfread(&c, sizeof(c), 1, fin) && (c != 0)) {
if (size == 0) {
size = 16;
- buff = xmalloc(size * sizeof(*buff));
+ buff = (gbint16*) xmalloc(size * sizeof(*buff));
} else if (pos == size) {
size += 16;
- buff = xrealloc(buff, size * sizeof(*buff));
+ buff = (gbint16*) xrealloc(buff, size * sizeof(*buff));
}
buff[pos] = c;
pos += 1;
}
if (pos != 0) {
- char *res;
+ char* res;
if (discard) {
res = NULL;
} else {
}
static void
-write_wcstr(const char *str)
+write_wcstr(const char* str)
{
int len;
- short *unicode;
+ short* unicode;
unicode = cet_str_utf8_to_uni(str, &len);
- gbfwrite((void *)unicode, 2, len + 1, fout);
+ gbfwrite((void*)unicode, 2, len + 1, fout);
xfree(unicode);
}
static int
-read_until_wcstr(const char *str)
+read_until_wcstr(const char* str)
{
- char *buff;
+ char* buff;
int len, sz;
int eos = 0, res = 0;
len = strlen(str);
sz = (len + 1) * 2;
- buff = xcalloc(sz, 1);
+ buff = (char*) xcalloc(sz, 1);
while (! gbfeof(fin)) {
if (c == 0) {
eos++;
if (eos >= 2) { /* two or more zero bytes => end of string */
- char *test = cet_str_uni_to_utf8((short *)buff, len);
+ char* test = cet_str_uni_to_utf8((short*)buff, len);
if (test) {
res = (strcmp(str, test) == 0);
xfree(test);
static void
destinator_read_poi(void)
{
- waypoint *wpt;
+ waypoint* wpt;
int count = 0;
gbfrewind(fin);
while (!(gbfeof(fin))) {
- char *str, *hnum;
+ char* str, *hnum;
double ll;
- garmin_fs_t *gmsd;
+ garmin_fs_t* gmsd;
if (count == 0) {
str = read_wcstr(0);
destinator_read_rte(void)
{
int count = 0;
- route_head *rte = NULL;
+ route_head* rte = NULL;
gbfrewind(fin);
while (!(gbfeof(fin))) {
- char *str;
- waypoint *wpt;
+ char* str;
+ waypoint* wpt;
if (count == 0) {
str = read_wcstr(0);
{
char TXT[4] = "TXT";
int recno = -1;
- route_head *trk = NULL;
+ route_head* trk = NULL;
gbfrewind(fin);
while (!(gbfeof(fin))) {
- waypoint *wpt;
+ waypoint* wpt;
struct tm tm;
char buff[20];
int date;
(void) gbfgetdbl(fin); /* unknown */
(void) gbfgetdbl(fin); /* unknown */
- wpt->fix = gbfgetint32(fin);
+ wpt->fix = (fix_type) gbfgetint32(fin);
wpt->sat = gbfgetint32(fin);
gbfseek(fin, 12 * sizeof(gbint32), SEEK_CUR); /* SAT info */
/*-----------------------------------------------------------------------------*/
static void
-destinator_wpt_disp(const waypoint *wpt)
+destinator_wpt_disp(const waypoint* wpt)
{
- garmin_fs_t *gmsd = GMSD_FIND(wpt);
+ garmin_fs_t* gmsd = GMSD_FIND(wpt);
write_wcstr(DST_DYN_POI);
write_wcstr((wpt->shortname) ? wpt->shortname : "WPT");
}
static void
-destinator_trkpt_disp(const waypoint *wpt)
+destinator_trkpt_disp(const waypoint* wpt)
{
int i;
}
static void
-destinator_rtept_disp(const waypoint *wpt)
+destinator_rtept_disp(const waypoint* wpt)
{
write_wcstr(DST_ITINERARY);
write_wcstr((wpt->shortname) ? wpt->shortname : "RTEPT");
*******************************************************************************/
static void
-destinator_rd_init(const char *fname)
+destinator_rd_init(const char* fname)
{
fin = gbfopen_le(fname, "rb", MYNAME);
}
}
static void
-destinator_wr_init(const char *fname)
+destinator_wr_init(const char* fname)
{
fout = gbfopen_le(fname, "wb", MYNAME);
}
ff_vecs_t destinator_poi_vecs = {
ff_type_file,
{
- ff_cap_read | ff_cap_write /* waypoints */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */,
ff_cap_none /* tracks */,
ff_cap_none /* routes */
},
{
ff_cap_none /* waypoints */,
ff_cap_none /* tracks */,
- ff_cap_read | ff_cap_write /* routes */
+ (ff_cap)(ff_cap_read | ff_cap_write) /* routes */
},
destinator_rd_init,
destinator_wr_init,
ff_type_file,
{
ff_cap_none /* waypoints */,
- ff_cap_read | ff_cap_write /* tracks */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */,
ff_cap_none /* routes */
},
destinator_rd_init,
#define MYNAME "DG-100"
-static void *serial_handle;
+static void* serial_handle;
/* maximum frame size observed so far: 1817 bytes
* (dg100cmd_getfileheader returning 150 entries)
int sendsize;
int recvsize;
int trailing_bytes;
- const char *text; /* Textual description for debugging */
+ const char* text; /* Textual description for debugging */
};
struct dg100_command dg100_commands[] = {
struct dynarray16 {
unsigned count; /* number of elements used */
unsigned limit; /* number of elements allocated */
- gbint16 *data;
+ gbint16* data;
};
/* helper functions */
-static struct dg100_command *
+static struct dg100_command*
dg100_findcmd(int id) {
unsigned int i;
}
static void
-dynarray16_init(struct dynarray16 *a, unsigned limit)
+dynarray16_init(struct dynarray16* a, unsigned limit)
{
a->count = 0;
a->limit = limit;
- a->data = xmalloc(sizeof(a->data[0]) * a->limit);
+ a->data = (gbint16*) xmalloc(sizeof(a->data[0]) * a->limit);
}
-static gbint16 *
-dynarray16_alloc(struct dynarray16 *a, unsigned n)
+static gbint16*
+dynarray16_alloc(struct dynarray16* a, unsigned n)
{
unsigned oldcount, need;
const unsigned elements_per_chunk = 4096 / sizeof(a->data[0]);
need = a->count - a->limit;
need = (need > elements_per_chunk) ? need : elements_per_chunk;
a->limit += need;
- a->data = xrealloc(a->data, sizeof(a->data[0]) * a->limit);
+ a->data = (gbint16*) xrealloc(a->data, sizeof(a->data[0]) * a->limit);
}
return(a->data + oldcount);
}
}
static void
-dg100_debug(const char *hdr, int include_nl, size_t sz, unsigned char *buf)
+dg100_debug(const char* hdr, int include_nl, size_t sz, unsigned char* buf)
{
unsigned int i;
}
static void
-dg100_log(const char *fmt, ...)
+dg100_log(const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
}
static void
-process_gpsfile(gbuint8 data[], route_head *track)
+process_gpsfile(gbuint8 data[], route_head* track)
{
const int recordsizes[3] = {8, 20, 32};
int i, style, recsize;
int lat, lon, bintime, bindate;
- waypoint *wpt;
+ waypoint* wpt;
/* the first record of each file is always full-sized; its style field
* determines the format of all subsequent records in the file */
/* communication functions */
static size_t
-dg100_send(gbuint8 cmd, const void *payload, size_t count)
+dg100_send(gbuint8 cmd, const void* payload, size_t count)
{
gbuint8 frame[FRAME_MAXLEN];
gbuint16 checksum, payload_len;
n = gbser_write(serial_handle, frame, framelen);
if (global_opts.debug_level) {
- struct dg100_command *cmdp = dg100_findcmd(cmd);
+ struct dg100_command* cmdp = dg100_findcmd(cmd);
dg100_debug(n == 0 ? "Sent: " : "Error Sending:",
1, framelen, frame);
* framing around the data), so the caller must copy the data before calling
* this function again */
static int
-dg100_recv_frame(struct dg100_command **cmdinfo_result, gbuint8 **payload)
+dg100_recv_frame(struct dg100_command** cmdinfo_result, gbuint8** payload)
{
static gbuint8 buf[FRAME_MAXLEN];
gbuint16 frame_start_seq, payload_len_field;
gbuint16 frame_head, numheaders, sum;
gbuint8 c, cmd;
int i, param_len, frame_len;
- struct dg100_command *cmdinfo;
+ struct dg100_command* cmdinfo;
/* consume input until frame head sequence 0xA0A2 was received */
frame_head = 0;
/* return value: number of bytes copied into buf, -1 on error */
static int
-dg100_recv(gbuint8 expected_id, void *buf, unsigned int len)
+dg100_recv(gbuint8 expected_id, void* buf, unsigned int len)
{
int n;
- struct dg100_command *cmdinfo;
- gbuint8 *data;
+ struct dg100_command* cmdinfo;
+ gbuint8* data;
unsigned int copysize, trailing_bytes;
n = dg100_recv_frame(&cmdinfo, &data);
/* the number of bytes to be sent is determined by cmd,
* count is the size of recvbuf */
static int
-dg100_request(gbuint8 cmd, const void *sendbuf, void *recvbuf, size_t count)
+dg100_request(gbuint8 cmd, const void* sendbuf, void* recvbuf, size_t count)
{
- struct dg100_command *cmdinfo;
+ struct dg100_command* cmdinfo;
int n, i, frames, fill;
- gbuint8 *buf;
+ gbuint8* buf;
cmdinfo = dg100_findcmd(cmd);
assert(cmdinfo != NULL);
/* the number of frames the answer will comprise */
frames = (cmd == dg100cmd_getfile) ? 2 : 1;
/* alias pointer for easy typecasting */
- buf = recvbuf;
+ buf = (gbuint8*) recvbuf;
fill = 0;
for (i = 0; i < frames; i++) {
n = dg100_recv(cmd, buf + fill, count - fill);
/* higher level communication functions */
static void
-dg100_getfileheaders(struct dynarray16 *headers)
+dg100_getfileheaders(struct dynarray16* headers)
{
gbuint8 request[2];
gbuint8 answer[FRAME_MAXLEN];
}
static void
-dg100_getfile(gbint16 num, route_head *track)
+dg100_getfile(gbint16 num, route_head* track)
{
gbuint8 request[2];
gbuint8 answer[2048];
unsigned int i;
int filenum;
struct dynarray16 headers;
- route_head *track;
+ route_head* track;
track = route_head_alloc();
track->rte_name = xstrdup("DG-100 tracklog");
/* GPSBabel integration */
-static char *erase;
-static char *erase_only;
+static char* erase;
+static char* erase_only;
static
arglist_t dg100_args[] = {
*******************************************************************************/
static void
-dg100_rd_init(const char *fname)
+dg100_rd_init(const char* fname)
{
if (serial_handle = gbser_init(fname), NULL == serial_handle) {
fatal(MYNAME ": Can't open port '%s'\n", fname);
#include "filterdefs.h"
#if FILTERS_ENABLED
-static char *hdopopt = NULL;
-static char *vdopopt = NULL;
-static char *andopt = NULL;
-static char *satopt = NULL;
-static char *fixnoneopt = NULL;
-static char *fixunknownopt = NULL;
-static char *eleminopt = NULL;
-static char *elemaxopt = NULL;
+static char* hdopopt = NULL;
+static char* vdopopt = NULL;
+static char* andopt = NULL;
+static char* satopt = NULL;
+static char* fixnoneopt = NULL;
+static char* fixunknownopt = NULL;
+static char* eleminopt = NULL;
+static char* elemaxopt = NULL;
static double hdopf;
static double vdopf;
static int satpf;
static int eleminpf;
static int elemaxpf;
static gpsdata_type what;
-static route_head *head;
+static route_head* head;
static
arglist_t fix_args[] = {
* Decide whether to keep or toss this point.
*/
static void
-fix_process_wpt(const waypoint *wpt)
+fix_process_wpt(const waypoint* wpt)
{
int del = 0;
int delh = 0;
int delv = 0;
- waypoint *waypointp = (waypoint *) wpt;
+ waypoint* waypointp = (waypoint*) wpt;
if ((hdopf >= 0.0) && (waypointp->hdop > hdopf)) {
delh = 1;
}
static void
-fix_process_head(const route_head *trk)
+fix_process_head(const route_head* trk)
{
- head = (route_head *)trk;
+ head = (route_head*)trk;
}
static void
}
static void
-fix_init(const char *args)
+fix_init(const char* args)
{
if (hdopopt) {
hdopf = atof(hdopopt);
#define DEFLATE_BUFF_SIZE 16384
-static gbfile *fin, *fout;
+static gbfile* fin, *fout;
-static char *xmlbin;
-static waypoint *xmlwpt;
-static route_head *xmltrk;
-static char *xmlgrid;
+static char* xmlbin;
+static waypoint* xmlwpt;
+static route_head* xmltrk;
+static char* xmlgrid;
static int xmldatum;
static double xmlEasting, xmlNorthing;
static double xmlLatitude, xmlLongitude;
#endif
static char header_written;
-static char *opt_index;
+static char* opt_index;
static int track_index, this_index;
static
{ tlog3a_xgcb_version, cb_cdata, "/CXMLSafe/Version" },
{ tlog3a_xgcb_length, cb_cdata, "/CXMLSafe/Length" },
{ tlog3a_xgcb_data, cb_cdata, "/CXMLSafe/Data" },
- { NULL, 0, NULL}
+ { NULL, (xg_cb_type)0, NULL}
};
#endif
{ tlog3b_xgcb_wptno, cb_cdata, "/CTrackFile/CTrackPoint/Northing" },
{ tlog3b_xgcb_wptal, cb_cdata, "/CTrackFile/CTrackPoint/Altitude" },
{ tlog3b_xgcb_tpten, cb_end, "/CTrackFile/CTrackPoint" },
- { NULL, 0, NULL}
+ { NULL, (xg_cb_type)0, NULL}
};
/* helpers */
static void
-convert_datum(waypoint *wpt, int datum)
+convert_datum(waypoint* wpt, int datum)
{
if (datum != DATUM_WGS84) {
double lat = wpt->latitude;
static void
-finalize_pt(waypoint *wpt)
+finalize_pt(waypoint* wpt)
{
if (strcmp(xmlgrid, "BNG") == 0) {
GPS_Math_NGENToAiry1830LatLon(xmlEasting, xmlNorthing,
#if !ZLIB_INHIBITED
static void
-tlog3a_xgcb_version(const char *args, const char **unused)
+tlog3a_xgcb_version(const char* args, const char** unused)
{
if (strcmp(args, "1") != 0) {
fatal(MYNAME ": Unsupported file version '%s'!\n", args);
}
static void
-tlog3a_xgcb_length(const char *args, const char **unused)
+tlog3a_xgcb_length(const char* args, const char** unused)
{
}
static void
-tlog3a_xgcb_data(const char *args, const char **unused)
+tlog3a_xgcb_data(const char* args, const char** unused)
{
int len;
- char *bin;
- char *cin, *cout;
+ char* bin;
+ char* cin, *cout;
char cl, ch;
len = strlen(args);
- bin = xmalloc((len >> 1) + 1);
+ bin = (char*) xmalloc((len >> 1) + 1);
- cin = (char *)args;
+ cin = (char*)args;
cout = bin;
cl = 0x10;
static void
-tlog3b_xgcb_tfna(const char *args, const char **unused)
+tlog3b_xgcb_tfna(const char* args, const char** unused)
{
if (xmltrk == NULL) {
xmltrk = route_head_alloc();
static void
-tlog3b_xgcb_tfdes(const char *args, const char **unused)
+tlog3b_xgcb_tfdes(const char* args, const char** unused)
{
if (xmltrk == NULL) {
xmltrk = route_head_alloc();
static void
-tlog3b_xgcb_wptst(const char *args, const char **unused)
+tlog3b_xgcb_wptst(const char* args, const char** unused)
{
xmlwpt = waypt_new();
xmldatum = DATUM_WGS84;
static void
-tlog3b_xgcb_tptst(const char *args, const char **unused)
+tlog3b_xgcb_tptst(const char* args, const char** unused)
{
xmlwpt = waypt_new();
xmldatum = DATUM_WGS84;
static void
-tlog3b_xgcb_tpten(const char *args, const char **unused)
+tlog3b_xgcb_tpten(const char* args, const char** unused)
{
finalize_pt(xmlwpt);
static void
-tlog3b_xgcb_wptid(const char *args, const char **unused)
+tlog3b_xgcb_wptid(const char* args, const char** unused)
{
if (*args) {
xmlwpt->shortname = xstrdup(args);
static void
-tlog3b_xgcb_wptdt(const char *args, const char **unused)
+tlog3b_xgcb_wptdt(const char* args, const char** unused)
{
xmldatum = GPS_Lookup_Datum_Index(args);
}
static void
-tlog3b_xgcb_wptgr(const char *args, const char **unused)
+tlog3b_xgcb_wptgr(const char* args, const char** unused)
{
if (xmlgrid != NULL) {
if (strcmp(xmlgrid, args) == 0) {
static void
-tlog3b_xgcb_wptno(const char *args, const char **unused)
+tlog3b_xgcb_wptno(const char* args, const char** unused)
{
xmlNorthing = atof(args);
}
static void
-tlog3b_xgcb_wptea(const char *args, const char **unused)
+tlog3b_xgcb_wptea(const char* args, const char** unused)
{
xmlEasting = atof(args);
}
static void
-tlog3b_xgcb_wptal(const char *args, const char **unused)
+tlog3b_xgcb_wptal(const char* args, const char** unused)
{
xmlAltitude = atof(args);
}
static void
-tlog3b_xgcb_tptdt(const char *args, const char **unused)
+tlog3b_xgcb_tptdt(const char* args, const char** unused)
{
xmldatum = GPS_Lookup_Datum_Index(args);
}
static void
-tlog3b_xgcb_wpten(const char *args, const char **unused)
+tlog3b_xgcb_wpten(const char* args, const char** unused)
{
finalize_pt(xmlwpt);
waypt_add(xmlwpt);
}
-static char *
-read_str(gbfile *f)
+static char*
+read_str(gbfile* f)
{
int i;
- char *res;
+ char* res;
i = gbfgetc(f);
if (i == 0xff) {
i = gbfgetint16(f);
}
- res = xmalloc(i + 1);
+ res = (char*) xmalloc(i + 1);
res[i] = '\0';
if (i) {
gbfread(res, 1, i, f);
}
static void
-write_str(const char *str, gbfile *f)
+write_str(const char* str, gbfile* f)
{
if (str && *str) {
int len = strlen(str);
}
static int
-read_datum(gbfile *f)
+read_datum(gbfile* f)
{
int res;
- char *d, *g;
+ char* d, *g;
d = read_str(f);
g = read_str(f);
gbint32 tcount, wcount;
gbint16 u1;
gbint32 ux;
- route_head *track;
+ route_head* track;
int i;
int datum;
/* S1 .. S9: comments, hints, jokes, aso */
for (i = 0; i < 9; i++) {
- char *s = read_str(fin);
+ char* s = read_str(fin);
xfree(s);
}
}
while (tcount > 0) {
- waypoint *wpt;
+ waypoint* wpt;
tcount--;
}
while (! gbfeof(fin)) {
- waypoint *wpt;
+ waypoint* wpt;
i = gbfgetc(fin);
if (i == 0) {
datum = read_datum(fin);
while (wcount > 0) {
- waypoint *wpt;
+ waypoint* wpt;
gbint32 namect, i;
wcount--;
// variants of shortname
for (i = 0; i < namect; i++) {
- char *name;
+ char* name;
name = read_str(fin);
if (name && *name) {
#if !ZLIB_INHIBITED
static int
-inflate_buff(const char *buff, const size_t size, char **out_buff)
+inflate_buff(const char* buff, const size_t size, char** out_buff)
{
int res = Z_OK;
z_stream strm;
char out[DEFLATE_BUFF_SIZE];
- char *cout = NULL;
+ char* cout = NULL;
gbuint32 bytes = 0;
gbuint32 have;
}
strm.avail_in = size;
- strm.next_in = (void *)buff;
+ strm.next_in = (Bytef*)buff;
do {
strm.avail_out = DEFLATE_BUFF_SIZE;
- strm.next_out = (void *)out;
+ strm.next_out = (Bytef*)out;
res = inflate(&strm, Z_NO_FLUSH);
switch (res) {
}
have = DEFLATE_BUFF_SIZE - strm.avail_out;
if (have > 0) {
- cout = xrealloc(cout, bytes + have);
+ cout = (char*) xrealloc(cout, bytes + have);
memcpy(cout+bytes, out, have);
bytes+=have;
}
static void
read_CXMLSafe(void)
{
- char *xmlstr = NULL;
+ char* xmlstr = NULL;
xmlbin = NULL;
xmlbinsize = 0;
*******************************************************************************/
static void
-dmtlog_rd_init(const char *fname)
+dmtlog_rd_init(const char* fname)
{
fin = gbfopen_le(fname, "rb", MYNAME);
}
static void
-dmtlog_wr_init(const char *fname)
+dmtlog_wr_init(const char* fname)
{
fout = gbfopen_le(fname, "wb", MYNAME);
}
}
static void
-write_header(const route_head *trk)
+write_header(const route_head* trk)
{
int count, i;
- char *cout;
+ char* cout;
const char ZERO = '\0';
header_written = 1;
count = 0;
if (trk != NULL) {
- queue *curr, *prev;
+ queue* curr, *prev;
QUEUE_FOR_EACH(&trk->waypoint_list, curr, prev) count++;
}
write_str(trk && trk->rte_name && *trk->rte_name ? trk->rte_name : "Name", fout);
}
static void
-track_hdr_cb(const route_head *trk)
+track_hdr_cb(const route_head* trk)
{
this_index++;
}
static void
-track_tlr_cb(const route_head *trk)
+track_tlr_cb(const route_head* trk)
{
}
static void
-track_wpt_cb(const waypoint *wpt)
+track_wpt_cb(const waypoint* wpt)
{
if (this_index != track_index) {
return;
}
static void
-wpt_cb(const waypoint *wpt)
+wpt_cb(const waypoint* wpt)
{
int names;
ff_vecs_t dmtlog_vecs = {
ff_type_file,
{
- ff_cap_read | ff_cap_write /* waypoints */,
- ff_cap_read | ff_cap_write /* tracks */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */,
ff_cap_none /* routes */
},
dmtlog_rd_init,
#include "filterdefs.h"
#if FILTERS_ENABLED
-static char *snopt = NULL;
-static char *lcopt = NULL;
-static char *purge_duplicates = NULL;
-static char *correct_coords = NULL;
+static char* snopt = NULL;
+static char* lcopt = NULL;
+static char* purge_duplicates = NULL;
+static char* correct_coords = NULL;
static
arglist_t dup_args[] = {
typedef struct btree_node {
- struct btree_node *left, *right;
+ struct btree_node* left, *right;
unsigned long data;
- waypoint *wpt;
+ waypoint* wpt;
} btree_node;
-static btree_node *
-addnode(btree_node * tree, btree_node * newnode, btree_node **oldnode)
+static btree_node*
+addnode(btree_node* tree, btree_node* newnode, btree_node** oldnode)
{
- btree_node * tmp, * last = NULL;
+ btree_node* tmp, * last = NULL;
if (*oldnode) {
*oldnode = NULL;
}
void
-free_tree(btree_node *tree)
+free_tree(btree_node* tree)
{
if (tree->left) {
free_tree(tree->left);
}
typedef struct {
- waypoint *wpt;
+ waypoint* wpt;
int index;
} wpt_ptr;
static
int
-compare(const void *a, const void *b)
+compare(const void* a, const void* b)
{
- const wpt_ptr *wa = (wpt_ptr *)a;
- const wpt_ptr *wb = (wpt_ptr *)b;
+ const wpt_ptr* wa = (wpt_ptr*)a;
+ const wpt_ptr* wb = (wpt_ptr*)b;
if (wa->wpt->gc_data->exported < wb->wpt->gc_data->exported) {
return 1;
static void
duplicate_process(void)
{
- waypoint * waypointp;
- btree_node * newnode, * btmp, * sup_tree = NULL;
- btree_node * oldnode = NULL;
+ waypoint* waypointp;
+ btree_node* newnode, * btmp, * sup_tree = NULL;
+ btree_node* oldnode = NULL;
unsigned long crc = 0;
struct {
char shortname[32];
char lat[13];
char lon[13];
} dupe;
- waypoint * delwpt = NULL;
+ waypoint* delwpt = NULL;
int i, ct = waypt_count();
- wpt_ptr *htable, *bh;
- queue *elem, *tmp;
+ wpt_ptr* htable, *bh;
+ queue* elem, *tmp;
- htable = (wpt_ptr *) xmalloc(ct * sizeof(*htable));
+ htable = (wpt_ptr*) xmalloc(ct * sizeof(*htable));
bh = htable;
i = 0;
QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
- bh->wpt = (waypoint *) elem;
+ bh->wpt = (waypoint*) elem;
bh->index = i;
i ++;
bh ++;
crc = get_crc32(&dupe, sizeof(dupe));
- newnode = (btree_node *)xcalloc(sizeof(btree_node), 1);
+ newnode = (btree_node*)xcalloc(sizeof(btree_node), 1);
newnode->data = crc;
newnode->wpt = waypointp;
#include "defs.h"
#include <ctype.h>
-static gbfile *file_in;
-static gbfile *file_out;
+static gbfile* file_in;
+static gbfile* file_out;
static short_handle mkshort_handle;
/* static char *deficon = NULL; */
};
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
int sz;
char ibuf[100] = {'0'} ;
- const char *ezsig = "TerraByte Location File";
+ const char* ezsig = "TerraByte Location File";
file_in = gbfopen_le(fname, "rb", MYNAME);
}
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
file_out = gbfopen_le(fname, "wb", MYNAME);
mkshort_handle = mkshort_new_handle();
char ibuf[10];
do {
unsigned char tag;
- waypoint *wpt_tmp;
+ waypoint* wpt_tmp;
wpt_tmp = waypt_new();
static void
-ez_disp(const waypoint *wpt)
+ez_disp(const waypoint* wpt)
{
gbfputc('W', file_out);
char longname[27];
} ENIGMA_WPT;
-static gbfile *file_in, *file_out;
+static gbfile* file_in, *file_out;
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
file_in = gbfopen_le(fname, "rb", MYNAME);
}
data_read(void)
{
struct enigma_wpt ewpt;
- route_head *route = route_head_alloc();
+ route_head* route = route_head_alloc();
route_add_head(route);
while (1 == gbfread(&ewpt, sizeof(ewpt), 1, file_in)) {
- waypoint *wpt = waypt_new();
+ waypoint* wpt = waypt_new();
wpt->latitude = enigmaPositionToDec(le_read32(&ewpt.latitude));
wpt->longitude = enigmaPositionToDec(le_read32(&ewpt.longitude));
wpt->shortname = xstrndup(ewpt.shortname, ewpt.shortname_len);
}
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
file_out = gbfopen_le(fname, "wb", MYNAME);
}
static void
-route_head_noop(const route_head *wp)
+route_head_noop(const route_head* wp)
{
}
#endif
static void
-enigma_waypt_disp(const waypoint *wpt)
+enigma_waypt_disp(const waypoint* wpt)
{
struct enigma_wpt ewpt;
ff_vecs_t enigma_vecs = {
ff_type_file,
{
- ff_cap_read | ff_cap_write, /* waypoints */
+ (ff_cap)(ff_cap_read | ff_cap_write), /* waypoints */
ff_cap_none, /* tracks */
- ff_cap_read | ff_cap_write /* routes */
+ (ff_cap)(ff_cap_read | ff_cap_write) /* routes */
},
rd_init,
wr_init,
gbuint32 offs;
#endif
unsigned char data_is_dynamic:1;
- void *data;
+ void* data;
} exif_tag_t;
typedef struct exif_ifd_s {
queue Q;
gbuint16 marker;
gbsize_t len;
- gbfile *fcache;
- gbfile *fexif;
+ gbfile* fcache;
+ gbfile* fexif;
queue ifds;
} exif_app_t;
-static gbfile *fin, *fout;
+static gbfile* fin, *fout;
static queue exif_apps;
-static exif_app_t *exif_app;
-const waypoint *exif_wpt_ref;
+static exif_app_t* exif_app;
+const waypoint* exif_wpt_ref;
time_t exif_time_ref;
static char exif_success;
-static char *exif_fout_name;
+static char* exif_fout_name;
-static char *opt_filename, *opt_overwrite, *opt_frame, *opt_name;
+static char* opt_filename, *opt_overwrite, *opt_frame, *opt_name;
arglist_t exif_args[] = {
{ "filename", &opt_filename, "Set waypoint name to source filename", "Y", ARGTYPE_BOOL, ARG_NOMINMAX },
#ifdef EXIF_DBG
static void
-print_buff(const char *buf, int sz, const char *cmt)
+print_buff(const char* buf, int sz, const char* cmt)
{
int i;
return size;
}
-static char *
+static char*
exif_time_str(const time_t time)
{
struct tm tm;
- char *res;
+ char* res;
tm = *localtime(&time);
tm.tm_year += 1900;
return res;
}
-static char *
-exif_read_str(exif_tag_t *tag)
+static char*
+exif_read_str(exif_tag_t* tag)
{
// Panasonic DMC-TZ10 stores datum with trailing spaces.
- char *buf = xstrndup((char *)tag->data, tag->size);
+ char* buf = xstrndup((char*)tag->data, tag->size);
rtrim(buf);
return buf;
}
static double
-exif_read_double(const exif_tag_t *tag, const int index)
+exif_read_double(const exif_tag_t* tag, const int index)
{
unsigned int num, den;
- gbint32 *data = (void *)tag->data;
+ gbint32* data = (gbint32*)tag->data;
num = data[index * 2];
den = data[(index * 2) + 1];
}
static double
-exif_read_coord(const exif_tag_t *tag)
+exif_read_coord(const exif_tag_t* tag)
{
double res, min, sec;
}
static time_t
-exif_read_timestamp(const exif_tag_t *tag)
+exif_read_timestamp(const exif_tag_t* tag)
{
double hour, min, sec;
}
static time_t
-exif_read_datestamp(const exif_tag_t *tag)
+exif_read_datestamp(const exif_tag_t* tag)
{
struct tm tm;
- char *str;
+ char* str;
memset(&tm, 0, sizeof(tm));
- str = xstrndup((char *)tag->data, tag->size);
+ str = xstrndup((char*)tag->data, tag->size);
sscanf(str, "%d:%d:%d", &tm.tm_year, &tm.tm_mon, &tm.tm_mday);
xfree(str);
}
static void
-exif_release_tag(exif_tag_t *tag)
+exif_release_tag(exif_tag_t* tag)
{
dequeue(&tag->Q);
if (tag->data_is_dynamic) {
}
static void
-exif_release_ifd(exif_ifd_t *ifd)
+exif_release_ifd(exif_ifd_t* ifd)
{
if (ifd != NULL) {
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&ifd->tags, elem, tmp) {
- exif_release_tag((exif_tag_t *)elem);
+ exif_release_tag((exif_tag_t*)elem);
}
xfree(ifd);
}
static void
exif_release_apps(void)
{
- queue *e0, *t0;
+ queue* e0, *t0;
QUEUE_FOR_EACH(&exif_apps, e0, t0) {
- queue *e1, *t1;
- exif_app_t *app = (exif_app_t *)dequeue(e0);
+ queue* e1, *t1;
+ exif_app_t* app = (exif_app_t*)dequeue(e0);
if (app->fcache) {
gbfclose(app->fcache);
gbfclose(app->fexif);
}
QUEUE_FOR_EACH(&app->ifds, e1, t1) {
- exif_ifd_t *ifd = (exif_ifd_t *)dequeue(e1);
+ exif_ifd_t* ifd = (exif_ifd_t*)dequeue(e1);
exif_release_ifd(ifd);
}
xfree(app);
}
static gbuint32
-exif_ifd_size(exif_ifd_t *ifd)
+exif_ifd_size(exif_ifd_t* ifd)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
gbuint32 res = 6; /* nr of tags + next_ifd */
res += (ifd->count * 12);
QUEUE_FOR_EACH(&ifd->tags, elem, tmp) {
- exif_tag_t *tag = (exif_tag_t *)elem;
+ exif_tag_t* tag = (exif_tag_t*)elem;
if (tag->size > 4) {
gbuint32 size = tag->size;
if (size & 1) {
return res;
}
-static exif_app_t *
+static exif_app_t*
exif_load_apps(void)
{
- exif_app_t *exif_app = NULL;
+ exif_app_t* exif_app = NULL;
while (! gbfeof(fin)) {
- exif_app_t *app = xcalloc(sizeof(*app), 1);
+ exif_app_t* app = (exif_app_t*) xcalloc(sizeof(*app), 1);
ENQUEUE_TAIL(&exif_apps, &app->Q);
QUEUE_INIT(&app->ifds);
return exif_app;
}
-static exif_ifd_t *
-exif_read_ifd(exif_app_t *app, const gbuint16 ifd_nr, gbsize_t offs,
- gbuint32 *exif_ifd_ofs, gbuint32 *gps_ifd_ofs, gbuint32 *inter_ifd_ofs)
+static exif_ifd_t*
+exif_read_ifd(exif_app_t* app, const gbuint16 ifd_nr, gbsize_t offs,
+ gbuint32* exif_ifd_ofs, gbuint32* gps_ifd_ofs, gbuint32* inter_ifd_ofs)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
gbuint16 i;
- exif_ifd_t *ifd;
- gbfile *fin = app->fexif;
+ exif_ifd_t* ifd;
+ gbfile* fin = app->fexif;
- ifd = xcalloc(sizeof(*ifd), 1);
+ ifd = (exif_ifd_t*) xcalloc(sizeof(*ifd), 1);
QUEUE_INIT(&ifd->tags);
ENQUEUE_TAIL(&app->ifds, &ifd->Q);
ifd->nr = ifd_nr;
#ifdef EXIF_DBG
{
- char *name;
+ char* name;
switch (ifd_nr) {
case IFD0:
name = "IFD0";
}
for (i = 0; i < ifd->count; i++) {
- exif_tag_t *tag;
+ exif_tag_t* tag;
offs = gbftell(fin);
- tag = xcalloc(sizeof(*tag), 1);
+ tag = (exif_tag_t*) xcalloc(sizeof(*tag), 1);
ENQUEUE_TAIL(&ifd->tags, &tag->Q);
ifd->next_ifd = gbfgetuint16(fin);
QUEUE_FOR_EACH(&ifd->tags, elem, tmp) {
- exif_tag_t *tag = (exif_tag_t *)elem;
+ exif_tag_t* tag = (exif_tag_t*)elem;
if ((tag->size > 4) && (tag->value)) {
gbuint16 i;
- char *ptr;
+ char* ptr;
tag->data = xmalloc(tag->size);
tag->data_is_dynamic = 1;
- ptr = tag->data;
+ ptr = (char*) tag->data;
gbfseek(fin, tag->value, SEEK_SET);
if (BYTE_TYPE(tag->type)) {
switch (tag->type) {
case EXIF_TYPE_SHORT:
case EXIF_TYPE_SSHORT:
- *(gbint16 *)ptr = gbfgetuint16(fin);
+ *(gbint16*)ptr = gbfgetuint16(fin);
break;
case EXIF_TYPE_IFD:
case EXIF_TYPE_LONG:
case EXIF_TYPE_SLONG:
- *(gbint32 *)ptr = gbfgetuint32(fin);
+ *(gbint32*)ptr = gbfgetuint32(fin);
break;
case EXIF_TYPE_RAT:
case EXIF_TYPE_SRAT:
- *(gbint32 *)ptr = gbfgetuint32(fin);
- *(gbint32 *)(ptr+4) = gbfgetuint32(fin);
+ *(gbint32*)ptr = gbfgetuint32(fin);
+ *(gbint32*)(ptr+4) = gbfgetuint32(fin);
break;
case EXIF_TYPE_FLOAT:
- *(float *)ptr = gbfgetflt(fin);
+ *(float*)ptr = gbfgetflt(fin);
break;
case EXIF_TYPE_DOUBLE:
- *(double *)ptr = gbfgetdbl(fin);
+ *(double*)ptr = gbfgetdbl(fin);
break;
default:
gbfread(ptr, 1, 1, fin);
}
static void
-exif_read_app(exif_app_t *app)
+exif_read_app(exif_app_t* app)
{
gbsize_t offs;
gbuint32 exif_ifd_ofs, gps_ifd_ofs, inter_ifd_ofs;
- exif_ifd_t *ifd;
- gbfile *fin = app->fexif;
+ exif_ifd_t* ifd;
+ gbfile* fin = app->fexif;
#ifdef EXIF_DBG
printf(MYNAME ": read_app...\n");
- print_buff((const char *)fin->handle.mem, 16, MYNAME);
+ print_buff((const char*)fin->handle.mem, 16, MYNAME);
printf("\n");
#endif
exif_ifd_ofs = gps_ifd_ofs = inter_ifd_ofs = 0;
}
static void
-exif_examine_app(exif_app_t *app)
+exif_examine_app(exif_app_t* app)
{
gbuint16 endianess;
gbuint32 ident;
- gbfile *ftmp = exif_app->fcache;
+ gbfile* ftmp = exif_app->fcache;
int i;
gbfrewind(ftmp);
exif_read_app(exif_app);
}
-static exif_ifd_t *
-exif_find_ifd(exif_app_t *app, const gbuint16 ifd_nr)
+static exif_ifd_t*
+exif_find_ifd(exif_app_t* app, const gbuint16 ifd_nr)
{
- queue *e0, *t0;
+ queue* e0, *t0;
QUEUE_FOR_EACH(&app->ifds, e0, t0) {
- exif_ifd_t *ifd = (exif_ifd_t *)e0;
+ exif_ifd_t* ifd = (exif_ifd_t*)e0;
if (ifd->nr == ifd_nr) {
return ifd;
return NULL;
}
-static exif_tag_t *
-exif_find_tag(exif_app_t *app, const gbuint16 ifd_nr, const gbuint16 tag_id)
+static exif_tag_t*
+exif_find_tag(exif_app_t* app, const gbuint16 ifd_nr, const gbuint16 tag_id)
{
- exif_ifd_t *ifd = exif_find_ifd(app, ifd_nr);
+ exif_ifd_t* ifd = exif_find_ifd(app, ifd_nr);
if (ifd != NULL) {
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&ifd->tags, elem, tmp) {
- exif_tag_t *tag = (exif_tag_t *)elem;
+ exif_tag_t* tag = (exif_tag_t*)elem;
if (tag->id == tag_id) {
return tag;
}
}
static time_t
-exif_get_exif_time(exif_app_t *app)
+exif_get_exif_time(exif_app_t* app)
{
- exif_tag_t *tag;
+ exif_tag_t* tag;
time_t res = 0;
tag = exif_find_tag(app, EXIF_IFD, 0x9003); /* DateTimeOriginal from EXIF */
}
if (tag) {
struct tm tm;
- char *c, *str;
+ char* c, *str;
memset(&tm, 0, sizeof(tm));
str = exif_read_str(tag);
return res;
}
-static waypoint *
-exif_waypt_from_exif_app(exif_app_t *app)
+static waypoint*
+exif_waypt_from_exif_app(exif_app_t* app)
{
- waypoint *wpt;
- queue *elem, *tmp;
- exif_ifd_t *ifd;
- exif_tag_t *tag;
+ waypoint* wpt;
+ queue* elem, *tmp;
+ exif_ifd_t* ifd;
+ exif_tag_t* tag;
char lat_ref = '\0';
char lon_ref = '\0';
char alt_ref = 0;
char speed_ref = '\0';
- char *datum = NULL;
+ char* datum = NULL;
char mode = '\0';
double gpsdop = unknown_alt;
double alt = unknown_alt;
wpt->longitude = unknown_alt;
QUEUE_FOR_EACH(&ifd->tags, elem, tmp) {
- tag = (exif_tag_t *)elem;
+ tag = (exif_tag_t*)elem;
switch (tag->id) {
case GPS_IFD_TAG_VERSION:
break;
case GPS_IFD_TAG_LATREF:
- lat_ref = *(char *)tag->data;
+ lat_ref = *(char*)tag->data;
break;
case GPS_IFD_TAG_LAT:
wpt->latitude = exif_read_coord(tag);
break;
case GPS_IFD_TAG_LONREF:
- lon_ref = *(char *)tag->data;
+ lon_ref = *(char*)tag->data;
break;
case GPS_IFD_TAG_LON:
wpt->longitude = exif_read_coord(tag);
break;
case GPS_IFD_TAG_ALTREF:
- alt_ref = *(char *)tag->data;
+ alt_ref = *(char*)tag->data;
break;
case GPS_IFD_TAG_ALT:
alt = exif_read_double(tag, 0);
timestamp = exif_read_timestamp(tag);
break;
case GPS_IFD_TAG_SAT:
- wpt->sat = atoi((char *)tag->data);
+ wpt->sat = atoi((char*)tag->data);
break;
case GPS_IFD_TAG_MODE:
- mode = *(char *)tag->data;
+ mode = *(char*)tag->data;
break;
case GPS_IFD_TAG_DOP:
gpsdop = exif_read_double(tag, 0);
break;
case GPS_IFD_TAG_SPEEDREF:
- speed_ref = *(char *)tag->data;
+ speed_ref = *(char*)tag->data;
break;
case GPS_IFD_TAG_SPEED:
WAYPT_SET(wpt, speed, exif_read_double(tag, 0));
}
if (timestamp != UNKNOWN_TIMESTAMP) {
#ifdef EXIF_DBG
- char *str = exif_time_str(timestamp);
+ char* str = exif_time_str(timestamp);
printf(MYNAME "-GPSTimeStamp = %s\n", str);
xfree(str);
#endif
tag = exif_find_tag(app, EXIF_IFD, EXIF_IFD_TAG_USER_CMT); /* UserComment */
if (tag && (tag->size > 8)) {
- char *str = NULL;
+ char* str = NULL;
if (memcmp(tag->data, "ASCII\0\0\0", 8) == 0) {
- str = xstrndup((char *)tag->data + 8, tag->size - 8);
+ str = xstrndup((char*)tag->data + 8, tag->size - 8);
} else if (memcmp(tag->data, "UNICODE\0", 8) == 0) {
int i, len = (tag->size - 8) / 2;
- gbint16 *s = (void *)((char *)tag->data + 8);
+ gbint16* s = (gbint16*)((char*)tag->data + 8);
for (i = 0; i < len; i++) {
s[i] = be_read16(&s[i]); /* always BE ? */
}
}
if (opt_filename) {
- char *c, *cx;
- char *str = xstrdup(fin->name);
+ char* c, *cx;
+ char* str = xstrdup(fin->name);
cx = str;
if ((c = strrchr(cx, ':'))) {
}
static void
-exif_dec2frac(double val, gbint32 *num, gbint32 *den)
+exif_dec2frac(double val, gbint32* num, gbint32* den)
{
char sval[16], snum[16];
char dot = 0;
int den1 = 1;
int num1, num2, den2, rem;
- char *cx;
+ char* cx;
double vx;
if (val < 0.000000001) {
*den = den1 / rem;
}
-static exif_tag_t *
-exif_put_value(const int ifd_nr, const gbuint16 tag_id, const gbuint16 type, const gbuint32 count, const int index, const void *data)
+static exif_tag_t*
+exif_put_value(const int ifd_nr, const gbuint16 tag_id, const gbuint16 type, const gbuint32 count, const int index, const void* data)
{
- exif_tag_t *tag = NULL;
- exif_ifd_t *ifd;
+ exif_tag_t* tag = NULL;
+ exif_ifd_t* ifd;
gbuint16 item_size, size;
ifd = exif_find_ifd(exif_app, ifd_nr);
if (ifd == NULL) {
- ifd = xcalloc(sizeof(*ifd), 1);
+ ifd = (exif_ifd_t*) xcalloc(sizeof(*ifd), 1);
ifd->nr = ifd_nr;
QUEUE_INIT(&ifd->tags);
ENQUEUE_TAIL(&exif_app->ifds, &ifd->Q);
return NULL;
}
- tag = xcalloc(sizeof(*tag), 1);
+ tag = (exif_tag_t*) xcalloc(sizeof(*tag), 1);
tag->id = tag_id;
tag->type = type;
}
if (tag->count < (index + count)) {
if (! tag->data_is_dynamic) {
- void *tmp = xmalloc(tag->size < 4 ? 4 : tag->size);
+ void* tmp = xmalloc(tag->size < 4 ? 4 : tag->size);
memcpy(tmp, tag->data, tag->size);
tag->data = tmp;
tag->data_is_dynamic = 1;
switch (type) {
case EXIF_TYPE_RAT:
case EXIF_TYPE_SRAT: {
- double val = *(double *)data;
- gbuint32 *dest = tag->data;
+ double val = *(double*)data;
+ gbuint32* dest = (gbuint32*) tag->data;
if ((int)val == val) {
dest[index * 2] = (int)val;
}
break;
default: {
- char *dest = tag->data;
+ char* dest = (char*) tag->data;
memcpy(&dest[index * item_size], data, count * item_size);
}
}
static void
-exif_put_str(const int ifd_nr, const int tag_id, const char *val)
+exif_put_str(const int ifd_nr, const int tag_id, const char* val)
{
int len = (val) ? strlen(val) + 1 : 0;
exif_put_value(ifd_nr, tag_id, EXIF_TYPE_ASCII, len, 0, val);
}
static void
-exif_find_wpt_by_time(const waypoint *wpt)
+exif_find_wpt_by_time(const waypoint* wpt)
{
if (wpt->creation_time <= 0) {
return;
}
static void
-exif_find_wpt_by_name(const waypoint *wpt)
+exif_find_wpt_by_name(const waypoint* wpt)
{
if (exif_wpt_ref != NULL) {
return;
static int
-exif_sort_tags_cb(const queue *A, const queue *B)
+exif_sort_tags_cb(const queue* A, const queue* B)
{
- exif_tag_t *ta = (exif_tag_t *)A;
- exif_tag_t *tb = (exif_tag_t *)B;
+ exif_tag_t* ta = (exif_tag_t*)A;
+ exif_tag_t* tb = (exif_tag_t*)B;
return ta->id - tb->id;
}
static int
-exif_sort_ifds_cb(const queue *A, const queue *B)
+exif_sort_ifds_cb(const queue* A, const queue* B)
{
- exif_ifd_t *ia = (exif_ifd_t *)A;
- exif_ifd_t *ib = (exif_ifd_t *)B;
+ exif_ifd_t* ia = (exif_ifd_t*)A;
+ exif_ifd_t* ib = (exif_ifd_t*)B;
return ia->nr - ib->nr;
}
static void
-exif_write_value(exif_tag_t *tag, gbfile *fout)
+exif_write_value(exif_tag_t* tag, gbfile* fout)
{
if (tag->size > 4) {
gbfputuint32(tag->value, fout); /* offset to data */
} else {
- char *data = tag->data;
+ char* data = (char*) tag->data;
if BYTE_TYPE(tag->type) {
gbfwrite(data, 4, 1, fout);
} else if WORD_TYPE(tag->type) {
- gbfputuint16(*(gbuint16 *)data, fout);
- gbfputuint16(*(gbuint16 *)(data+2), fout);
+ gbfputuint16(*(gbuint16*)data, fout);
+ gbfputuint16(*(gbuint16*)(data+2), fout);
} else if LONG_TYPE(tag->type) {
- gbfputuint32(*(gbuint32 *)data, fout);
+ gbfputuint32(*(gbuint32*)data, fout);
} else if (tag->type == EXIF_TYPE_FLOAT) {
- gbfputflt(*(float *)data, fout);
+ gbfputflt(*(float*)data, fout);
} else {
fatal(MYNAME ": Unknown data type %d!\n", tag->type);
}
}
static void
-exif_write_ifd(const exif_ifd_t *ifd, const char next, gbfile *fout)
+exif_write_ifd(const exif_ifd_t* ifd, const char next, gbfile* fout)
{
gbsize_t offs;
- queue *elem, *tmp;
+ queue* elem, *tmp;
gbfputuint16(ifd->count, fout);
offs = gbftell(fout) + (ifd->count * 12) + 4;
QUEUE_FOR_EACH(&ifd->tags, elem, tmp) {
- exif_tag_t *tag = (exif_tag_t *)elem;
+ exif_tag_t* tag = (exif_tag_t*)elem;
gbfputuint16(tag->id, fout);
gbfputuint16(tag->type, fout);
}
QUEUE_FOR_EACH(&ifd->tags, elem, tmp) {
- exif_tag_t *tag = (exif_tag_t *)elem;
+ exif_tag_t* tag = (exif_tag_t*)elem;
if (tag->size > 4) {
gbuint16 i;
- char *ptr = tag->data;
+ char* ptr = (char*) tag->data;
if BYTE_TYPE(tag->type) {
gbfwrite(tag->data, tag->size, 1, fout);
switch (tag->type) {
case EXIF_TYPE_SHORT:
case EXIF_TYPE_SSHORT:
- gbfputuint16(*(gbint16 *)ptr, fout);
+ gbfputuint16(*(gbint16*)ptr, fout);
break;
case EXIF_TYPE_LONG:
case EXIF_TYPE_SLONG:
case EXIF_TYPE_IFD:
- gbfputuint32(*(gbint32 *)ptr, fout);
+ gbfputuint32(*(gbint32*)ptr, fout);
break;
case EXIF_TYPE_RAT:
case EXIF_TYPE_SRAT:
- gbfputuint32(*(gbint32 *)ptr, fout);
- gbfputuint32(*(gbint32 *)(ptr+4), fout);
+ gbfputuint32(*(gbint32*)ptr, fout);
+ gbfputuint32(*(gbint32*)(ptr+4), fout);
break;
case EXIF_TYPE_FLOAT:
- gbfputflt(*(float *)ptr, fout);
+ gbfputflt(*(float*)ptr, fout);
break;
case EXIF_TYPE_DOUBLE:
- gbfputdbl(*(double *)ptr, fout);
+ gbfputdbl(*(double*)ptr, fout);
break;
default:
gbfwrite(ptr, exif_type_size(tag->type), 1, fin);
static void
exif_write_apps(void)
{
- queue *e0, *t0;
+ queue* e0, *t0;
gbfputuint16(0xFFD8, fout);
QUEUE_FOR_EACH(&exif_apps, e0, t0) {
- exif_app_t *app = (exif_app_t *)e0;
+ exif_app_t* app = (exif_app_t*)e0;
gbfputuint16(app->marker, fout);
if (app == exif_app) {
- queue *e1, *t1;
+ queue* e1, *t1;
gbuint16 len = 8;
- gbfile *ftmp;
- exif_tag_t *tag;
+ gbfile* ftmp;
+ exif_tag_t* tag;
exif_put_long(IFD0, IFD0_TAG_GPS_IFD_OFFS, 0, 0);
exif_put_long(GPS_IFD, GPS_IFD_TAG_VERSION, 0, 2);
sortqueue(&exif_app->ifds, exif_sort_ifds_cb);
QUEUE_FOR_EACH(&app->ifds, e1, t1) {
- exif_ifd_t *ifd = (exif_ifd_t *)e1;
+ exif_ifd_t* ifd = (exif_ifd_t*)e1;
if (ifd->nr == GPS_IFD) {
exif_put_long(IFD0, IFD0_TAG_GPS_IFD_OFFS, 0, len);
}
QUEUE_FOR_EACH(&app->ifds, e1, t1) {
- exif_ifd_t *ifd = (exif_ifd_t *)e1;
+ exif_ifd_t* ifd = (exif_ifd_t*)e1;
sortqueue(&ifd->tags, exif_sort_tags_cb);
}
gbfputuint32(0x08, ftmp); /* offset to first IFD */
QUEUE_FOR_EACH(&app->ifds, e1, t1) {
- exif_ifd_t *ifd = (exif_ifd_t *)e1;
- exif_ifd_t *ifd_next = (exif_ifd_t *)t1;
+ exif_ifd_t* ifd = (exif_ifd_t*)e1;
+ exif_ifd_t* ifd_next = (exif_ifd_t*)t1;
char next;
if ((ifd->nr == IFD0) && (ifd_next->nr == IFD1)) {
*******************************************************************************/
static void
-exif_rd_init(const char *fname)
+exif_rd_init(const char* fname)
{
fin = gbfopen_be(fname, "rb", MYNAME);
QUEUE_INIT(&exif_apps);
exif_read(void)
{
gbuint16 soi;
- waypoint *wpt;
+ waypoint* wpt;
soi = gbfgetuint16(fin);
is_fatal(soi != 0xFFD8, MYNAME ": Unknown image file."); /* only jpeg for now */
}
static void
-exif_wr_init(const char *fname)
+exif_wr_init(const char* fname)
{
gbuint16 soi;
- char *tmpname;
+ char* tmpname;
exif_success = 0;
exif_fout_name = xstrdup(fname);
static void
exif_wr_deinit(void)
{
- char *tmpname;
+ char* tmpname;
exif_release_apps();
tmpname = xstrdup(fout->name);
warning(MYNAME ": No matching point with name \"%s\" found.\n", opt_name);
}
} else {
- char *str = exif_time_str(exif_time_ref);
+ char* str = exif_time_str(exif_time_ref);
track_disp_all(NULL, NULL, exif_find_wpt_by_time);
route_disp_all(NULL, NULL, exif_find_wpt_by_time);
} else if (abs(exif_time_ref - exif_wpt_ref->creation_time) > frame) {
warning(MYNAME ": No matching point found for image date %s!\n", str);
if (exif_wpt_ref != NULL) {
- char *str = exif_time_str(exif_wpt_ref->creation_time);
+ char* str = exif_time_str(exif_wpt_ref->creation_time);
warning(MYNAME ": Best is from %s, %d second(s) away.\n",
str, abs(exif_time_ref - exif_wpt_ref->creation_time));
xfree(str);
}
if (exif_wpt_ref != NULL) {
- const waypoint *wpt = exif_wpt_ref;
+ const waypoint* wpt = exif_wpt_ref;
exif_put_long(IFD0, IFD0_TAG_GPS_IFD_OFFS, 0, 0);
exif_put_long(GPS_IFD, GPS_IFD_TAG_VERSION, 0, 2);
ff_vecs_t exif_vecs = {
ff_type_file,
{
- ff_cap_read | ff_cap_write /* waypoints */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */,
ff_cap_none /* tracks */,
ff_cap_none /* routes */
},
#include "inifile.h"
#include "explorist_ini.h"
-static inifile_t *inifile;
+static inifile_t* inifile;
static const char myname[] = "explorist";
-const char *
-explorist_read_value(const char* section, const char *key)
+const char*
+explorist_read_value(const char* section, const char* key)
{
return inifile_readstr(inifile, section, key);
}
-static mag_info *
-explorist_ini_try(const char *path)
+static mag_info*
+explorist_ini_try(const char* path)
{
- mag_info *info = NULL;
- char *inipath;
- char *s;
+ mag_info* info = NULL;
+ char* inipath;
+ char* s;
xasprintf(&inipath, "%s/%s", path, "APP/Atlas.ini");
inifile = inifile_init(inipath, myname);
return NULL;
}
- info = xmalloc(sizeof(mag_info));
+ info = (mag_info*) xmalloc(sizeof(mag_info));
info->geo_path = NULL;
info->track_path = NULL;
info->waypoint_path = NULL;
return info;
}
-mag_info *
-explorist_ini_get(const char **dirlist)
+mag_info*
+explorist_ini_get(const char** dirlist)
{
- mag_info *r = NULL;
+ mag_info* r = NULL;
while (dirlist && *dirlist) {
r = explorist_ini_try(*dirlist);
if (r) {
}
void
-explorist_ini_done(mag_info *info)
+explorist_ini_done(mag_info* info)
{
xfree(info->geo_path);
xfree(info->track_path);
char* waypoint_path;
} mag_info;
-mag_info * explorist_ini_get(const char **directory_list);
-void explorist_ini_done(mag_info *info);
+mag_info* explorist_ini_get(const char** directory_list);
+void explorist_ini_done(mag_info* info);
#include "defs.h"
void
-fatal(const char *fmt, ...)
+fatal(const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
}
void
-warning(const char *fmt, ...)
+warning(const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
*******************************************************************************/
static void
-filter_skeleton_init(const char *args)
+filter_skeleton_init(const char* args)
{
/* Called before filter processing */
#include "gbversion.h"
typedef struct {
- filter_vecs_t *vec;
- const char *name;
- const char *desc;
+ filter_vecs_t* vec;
+ const char* name;
+ const char* desc;
} fl_vecs_t;
extern filter_vecs_t position_vecs;
}
};
-filter_vecs_t *
-find_filter_vec(char *const vecname, char **opts)
+filter_vecs_t*
+find_filter_vec(char* const vecname, char** opts)
{
- fl_vecs_t *vec = filter_vec_list;
- char *v = xstrdup(vecname);
- char *svecname = strtok(v, ",");
+ fl_vecs_t* vec = filter_vec_list;
+ char* v = xstrdup(vecname);
+ char* svecname = strtok(v, ",");
int found = 0;
while (vec->vec) {
- arglist_t *ap;
- char *res;
+ arglist_t* ap;
+ char* res;
if (case_ignore_strcmp(svecname, vec->name)) {
vec++;
/* step 1: initialize by inifile or default values */
if (vec->vec->args) {
for (ap = vec->vec->args; ap->argstring; ap++) {
- const char *temp;
+ const char* temp;
temp = inifile_readstr(global_opts.inifile, vec->name, ap->argstring);
if (temp == NULL) {
if (vec->vec->args) {
for (ap = vec->vec->args; ap->argstring; ap++) {
- char *opt;
+ char* opt;
opt = get_option(*opts, ap->argstring);
if (opt) {
}
void
-free_filter_vec(filter_vecs_t *fvec)
+free_filter_vec(filter_vecs_t* fvec)
{
- arglist_t *ap;
+ arglist_t* ap;
if (fvec->args) {
for (ap = fvec->args; ap->argstring; ap++) {
void
init_filter_vecs(void)
{
- fl_vecs_t *vec = filter_vec_list;
+ fl_vecs_t* vec = filter_vec_list;
while (vec->vec) {
- arglist_t *ap;
+ arglist_t* ap;
if (vec->vec->args) {
for (ap = vec->vec->args; ap->argstring; ap++) {
ap->argvalptr = NULL;
void
exit_filter_vecs(void)
{
- fl_vecs_t *vec = filter_vec_list;
+ fl_vecs_t* vec = filter_vec_list;
while (vec->vec) {
if (vec->vec->f_exit) {
(vec->vec->f_exit)();
void
disp_filter_vecs(void)
{
- fl_vecs_t *vec;
- arglist_t *ap;
+ fl_vecs_t* vec;
+ arglist_t* ap;
for (vec = filter_vec_list; vec->vec; vec++) {
printf(" %-20.20s %-50.50s\n",
}
void
-disp_filter_vec(const char *vecname)
+disp_filter_vec(const char* vecname)
{
- fl_vecs_t *vec;
- arglist_t *ap;
+ fl_vecs_t* vec;
+ arglist_t* ap;
for (vec = filter_vec_list; vec->vec; vec++) {
if (case_ignore_strcmp(vec->name, vecname)) {
}
static signed int
-alpha(const void *a, const void *b)
+alpha(const void* a, const void* b)
{
- const fl_vecs_t *const ap = (const fl_vecs_t*) a;
- const fl_vecs_t *const bp = (const fl_vecs_t*) b;
+ const fl_vecs_t* const ap = (const fl_vecs_t*) a;
+ const fl_vecs_t* const bp = (const fl_vecs_t*) b;
return case_ignore_strcmp(ap->desc , bp->desc);
}
static
-void disp_help_url(const fl_vecs_t *vec, arglist_t *arg)
+void disp_help_url(const fl_vecs_t* vec, arglist_t* arg)
{
printf("\t" WEB_DOC_DIR "/fmt_%s.html", vec->name);
if (arg) {
}
static void
-disp_v1(const fl_vecs_t *vec)
+disp_v1(const fl_vecs_t* vec)
{
- arglist_t *ap;
+ arglist_t* ap;
disp_help_url(vec, NULL);
printf("\n");
void
disp_filters(int version)
{
- fl_vecs_t *vec;
+ fl_vecs_t* vec;
qsort(filter_vec_list,
sizeof(filter_vec_list) / sizeof(filter_vec_list[0]) - 1,
filter_process f_process;
filter_deinit f_deinit;
filter_exit f_exit;
- arglist_t *args;
+ arglist_t* args;
} filter_vecs_t;
-filter_vecs_t * find_filter_vec(char * const, char **);
-void free_filter_vec(filter_vecs_t *);
+filter_vecs_t* find_filter_vec(char* const, char**);
+void free_filter_vec(filter_vecs_t*);
void disp_filters(int version);
-void disp_filter(const char *vecname);
-void disp_filter_vec(const char *vecname);
+void disp_filter(const char* vecname);
+void disp_filter_vec(const char* vecname);
void disp_filter_vecs(void);
void init_filter_vecs(void);
void exit_filter_vecs(void);
*******************************************************************************/
static void
-format_skeleton_rd_init(const char *fname)
+format_skeleton_rd_init(const char* fname)
{
// fin = gbfopen(fname, "r", MYNAME);
}
}
static void
-format_skeleton_wr_init(const char *fname)
+format_skeleton_wr_init(const char* fname)
{
// fout = gbfopen(fname, "w", MYNAME);
}
#include "defs.h"
-format_specific_data *fs_chain_copy(format_specific_data *source)
+format_specific_data* fs_chain_copy(format_specific_data* source)
{
- format_specific_data *result = NULL;
+ format_specific_data* result = NULL;
- format_specific_data **copy = &result;
+ format_specific_data** copy = &result;
while (source) {
- source->copy((void **)copy, (void *)source);
+ source->copy((void**)copy, (void*)source);
/* prevent segfaults from badly-behaved copy functions */
(*copy)->next = NULL;
copy = &((*copy)->next);
return result;
}
-void fs_chain_destroy(format_specific_data *chain)
+void fs_chain_destroy(format_specific_data* chain)
{
- format_specific_data *cur = chain;
- format_specific_data *next = NULL;
+ format_specific_data* cur = chain;
+ format_specific_data* next = NULL;
while (cur) {
next = cur->next;
cur->destroy(cur);
}
}
-format_specific_data *fs_chain_find(format_specific_data *chain, long type)
+format_specific_data* fs_chain_find(format_specific_data* chain, long type)
{
- format_specific_data *cur = chain;
+ format_specific_data* cur = chain;
while (cur) {
if (cur->type == type) {
return cur;
return NULL;
}
-void fs_chain_add(format_specific_data **chain, format_specific_data *data)
+void fs_chain_add(format_specific_data** chain, format_specific_data* data)
{
data->next = *chain;
*chain = data;
#define G7T_HEADER "Version 2:G7T"
-static gbfile *fin;
+static gbfile* fin;
static grid_type grid;
static int datum;
static gpsdata_type mode;
#define WPT_cD_OFS 0x0cD00
static void
-parse_line(char *buff, int index, const char *delimiter, waypoint *wpt)
+parse_line(char* buff, int index, const char* delimiter, waypoint* wpt)
{
- char *cin;
+ char* cin;
garmin_fs_p gmsd = GMSD_FIND(wpt);
while ((cin = csv_lineparse(buff, delimiter, "", index++))) {
int categories, dyn;
struct tm tm;
- char *cerr;
+ char* cerr;
case TRKPT__OFS + 1:
cin += parse_coordinates(cin, datum, grid,
}
}
-static waypoint *
-parse_waypt(char *buff)
+static waypoint*
+parse_waypt(char* buff)
{
- char *cin, *cerr;
+ char* cin, *cerr;
int i;
struct tm tm;
- waypoint *wpt;
+ waypoint* wpt;
garmin_fs_p gmsd;
wpt = waypt_new();
gmsd = garmin_fs_alloc(-1);
- fs_chain_add(&wpt->fs, (format_specific_data *) gmsd);
+ fs_chain_add(&wpt->fs, (format_specific_data*) gmsd);
if (gardown) {
cin = buff + 6;
return wpt;
}
-static waypoint *
-parse_trkpt(char *buff)
+static waypoint*
+parse_trkpt(char* buff)
{
garmin_fs_p gmsd;
- waypoint *wpt;
+ waypoint* wpt;
wpt = waypt_new();
gmsd = garmin_fs_alloc(-1);
- fs_chain_add(&wpt->fs, (format_specific_data *) gmsd);
+ fs_chain_add(&wpt->fs, (format_specific_data*) gmsd);
parse_line(buff, TRKPT__OFS, ";", wpt);
*/
static void
-parse_categories(char *buff)
+parse_categories(char* buff)
{
- char *cin;
+ char* cin;
int cat = 0;
while ((cin = csv_lineparse(buff, ",", "", cat++))) {
/* main functions */
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
fin = gbfopen(fname, "rb", MYNAME);
static void
data_read(void)
{
- char *buff;
+ char* buff;
int line = 0;
- waypoint *wpt = NULL;
- waypoint *prev = NULL;
- route_head *head = NULL;
+ waypoint* wpt = NULL;
+ waypoint* prev = NULL;
+ route_head* head = NULL;
while ((buff = gbfgetstr(fin))) {
- char *cin = buff;
- char *cdata;
+ char* cin = buff;
+ char* cdata;
if ((line++ == 0) && fin->unicode) {
cet_convert_init(CET_CHARSET_UTF8, 1);
cdata++;
}
if (*cdata) {
- char *s;
+ char* s;
s = strrchr(cdata, ',');
if (s) {
*s = '\0';
#define SOON 1
#define MYNAME "GARMIN"
-static const char *portname;
+static const char* portname;
static short_handle mkshort_handle;
-static GPS_PWay *tx_waylist;
-static GPS_PWay *tx_routelist;
-static GPS_PWay *cur_tx_routelist_entry;
-static GPS_PTrack *tx_tracklist;
-static GPS_PTrack *cur_tx_tracklist_entry;
+static GPS_PWay* tx_waylist;
+static GPS_PWay* tx_routelist;
+static GPS_PWay* cur_tx_routelist_entry;
+static GPS_PTrack* tx_tracklist;
+static GPS_PTrack* cur_tx_tracklist_entry;
static int my_track_count = 0;
-static char *getposn = NULL;
-static char *poweroff = NULL;
-static char *eraset = NULL;
-static char *resettime = NULL;
-static char *snlen = NULL;
-static char *snwhiteopt = NULL;
-static char *deficon = NULL;
-static char *category = NULL;
-static char *categorybitsopt = NULL;
+static char* getposn = NULL;
+static char* poweroff = NULL;
+static char* eraset = NULL;
+static char* resettime = NULL;
+static char* snlen = NULL;
+static char* snwhiteopt = NULL;
+static char* deficon = NULL;
+static char* category = NULL;
+static char* categorybitsopt = NULL;
static int categorybits;
static int receiver_must_upper = 1;
-static ff_vecs_t *gpx_vec;
+static ff_vecs_t* gpx_vec;
#define MILITANT_VALID_WAYPT_CHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
/* Technically, even this is a little loose as spaces arent allowed */
-static const char *valid_waypt_chars = MILITANT_VALID_WAYPT_CHARS " ";
+static const char* valid_waypt_chars = MILITANT_VALID_WAYPT_CHARS " ";
static
arglist_t garmin_args[] = {
ARG_TERMINATOR
};
-static const char * d103_symbol_from_icon_number(unsigned int n);
-static int d103_icon_number_from_symbol(const char *s);
+static const char* d103_symbol_from_icon_number(unsigned int n);
+static int d103_icon_number_from_symbol(const char* s);
static void
-rw_init(const char *fname)
+rw_init(const char* fname)
{
int receiver_short_length;
int receiver_must_upper = 1;
- const char * receiver_charset = NULL;
+ const char* receiver_charset = NULL;
if (!mkshort_handle) {
mkshort_handle = mkshort_new_handle();
}
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
if (setjmp(gdx_jmp_buf)) {
- char *vec_opts = NULL;
- const gdx_info *gi = gdx_get_info();
+ char* vec_opts = NULL;
+ const gdx_info* gi = gdx_get_info();
gpx_vec = find_vec("gpx", &vec_opts);
gpx_vec->rd_init(gi->from_device.canon);
} else {
}
static int
-waypt_read_cb(int total_ct, GPS_PWay *way)
+waypt_read_cb(int total_ct, GPS_PWay* way)
{
static int i;
waypt_read(void)
{
int i,n;
- GPS_PWay *way = NULL;
+ GPS_PWay* way = NULL;
if (getposn) {
- waypoint *wpt = waypt_new();
+ waypoint* wpt = waypt_new();
wpt->latitude = gps_save_lat;
wpt->longitude = gps_save_lon;
wpt->shortname = xstrdup("Position");
}
for (i = 0; i < n; i++) {
- waypoint *wpt_tmp = waypt_new();
+ waypoint* wpt_tmp = waypt_new();
wpt_tmp->shortname = xstrdup(way[i]->ident);
wpt_tmp->description = xstrdup(way[i]->cmnt);
// returns 1 if the waypoint's start_time can be found
// in the laps array, 0 otherwise
-unsigned int checkWayPointIsAtSplit(waypoint *wpt, GPS_PLap *laps, int nlaps)
+unsigned int checkWayPointIsAtSplit(waypoint* wpt, GPS_PLap* laps, int nlaps)
{
int result = 0;
track_read(void)
{
int32 ntracks;
- GPS_PTrack *array;
- route_head *trk_head = NULL;
+ GPS_PTrack* array;
+ route_head* trk_head = NULL;
int trk_num = 0;
int i;
- char *trk_name = "";
+ char* trk_name = "";
GPS_PLap* laps = NULL;
int nlaps = 0;
int next_is_new_trkseg = 0;
}
for (i = 0; i < ntracks; i++) {
- waypoint *wpt;
+ waypoint* wpt;
/*
* This is probably always in slot zero, but the Garmin
{
int32 nroutepts;
int i;
- GPS_PWay *array;
+ GPS_PWay* array;
/* TODO: Fixes warning but is it right?
* RJL: No, the warning isn't right; GCC's flow analysis is broken.
* still, it's good taste...
*/
- route_head *rte_head = NULL;
+ route_head* rte_head = NULL;
nroutepts = GPS_Command_Get_Route(portname, &array);
#if 1
for (i = 0; i < nroutepts; i++) {
if (array[i]->isrte) {
- char *csrc = NULL;
+ char* csrc = NULL;
/* What a horrible API has libjeeps for making this
* my problem.
*/
if (array[i]->islink) {
continue;
} else {
- waypoint *wpt_tmp = waypt_new();
+ waypoint* wpt_tmp = waypt_new();
wpt_tmp->latitude = array[i]->lat;
wpt_tmp->longitude = array[i]->lon;
wpt_tmp->shortname = array[i]->ident;
lap_read_as_track(void)
{
int32 ntracks;
- GPS_PLap *array;
- route_head *trk_head = NULL;
+ GPS_PLap* array;
+ route_head* trk_head = NULL;
int trk_num = 0;
int index;
int i;
return;
}
for (i = 0; i < ntracks; i++) {
- waypoint *wpt;
+ waypoint* wpt;
if (array[i]->index == -1) {
index=i;
} else {
/* D10xx - no real separator, use begin/end time to guess */
(abs(array[i-1]->start_time + array[i]->total_time/100-array[i]->start_time) > 2)
) {
- static struct tm * stmp;
+ static struct tm* stmp;
stmp = gmtime(&array[i]->start_time);
trk_head = route_head_alloc();
/*For D906, we would like to use the track_index in the last packet instead...*/
* to the data type we use throughout. Yes, we do lose some data that way.
*/
static void
-pvt2wpt(GPS_PPvt_Data pvt, waypoint *wpt)
+pvt2wpt(GPS_PPvt_Data pvt, waypoint* wpt)
{
double wptime, wptimes;
}
}
-static gpsdevh *pvt_fd;
+static gpsdevh* pvt_fd;
static void
-pvt_init(const char *fname)
+pvt_init(const char* fname)
{
rw_init(fname);
GPS_Command_Pvt_On(fname, &pvt_fd);
}
-static waypoint *
-pvt_read(posn_status *posn_status)
+static waypoint*
+pvt_read(posn_status* posn_status)
{
- waypoint *wpt = waypt_new();
+ waypoint* wpt = waypt_new();
GPS_PPvt_Data pvt = GPS_Pvt_New();
if (GPS_Command_Pvt_Get(&pvt_fd, &pvt)) {
}
static int
-waypt_write_cb(GPS_PWay *way)
+waypt_write_cb(GPS_PWay* way)
{
static int i;
int n = waypt_count();
* If we're using smart names, try to put the cache info in the
* description.
*/
-const char *
-get_gc_info(waypoint *wpt)
+const char*
+get_gc_info(waypoint* wpt)
{
if (global_opts.smart_names) {
if (wpt->gc_data->type == gt_virtual) {
{
int i;
int n = waypt_count();
- queue *elem, *tmp;
+ queue* elem, *tmp;
extern queue waypt_head;
int icon;
i = 0;
QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
- waypoint *wpt;
- char *ident;
- char *src = NULL;
+ waypoint* wpt;
+ char* ident;
+ char* src = NULL;
char obuf[256];
- wpt = (waypoint *) elem;
+ wpt = (waypoint*) elem;
if (wpt->description) {
src = wpt->description;
}
static void
-route_hdr_pr(const route_head *rte)
+route_hdr_pr(const route_head* rte)
{
(*cur_tx_routelist_entry)->rte_num = rte->rte_num;
(*cur_tx_routelist_entry)->isrte = 1;
}
static void
-route_waypt_pr(const waypoint *wpt)
+route_waypt_pr(const waypoint* wpt)
{
GPS_PWay rte = *cur_tx_routelist_entry;
- char *s, *d;
+ char* s, *d;
/*
* As stupid as this is, libjeeps seems to want an empty
}
static void
-route_noop(const route_head *wp)
+route_noop(const route_head* wp)
{
}
}
static void
-track_hdr_pr(const route_head *trk_head)
+track_hdr_pr(const route_head* trk_head)
{
(*cur_tx_tracklist_entry)->ishdr = gpsTrue;
if (trk_head->rte_name) {
}
static void
-track_waypt_pr(const waypoint *wpt)
+track_waypt_pr(const waypoint* wpt)
{
(*cur_tx_tracklist_entry)->lat = wpt->latitude;
(*cur_tx_tracklist_entry)->lon = wpt->longitude;
{ pvt_init, pvt_read, rw_deinit, NULL, NULL, NULL }
};
-static const char *d103_icons[16] = {
+static const char* d103_icons[16] = {
"dot",
"house",
"gas",
"back-track"
};
-static const char *
+static const char*
d103_symbol_from_icon_number(unsigned int n)
{
if (n <= 15) {
}
static int
-d103_icon_number_from_symbol(const char *s)
+d103_icon_number_from_symbol(const char* s)
{
unsigned int i;
#define MYNAME "whatever"
-static gdx_info *my_gdx_info;
+static gdx_info* my_gdx_info;
static int type;
-static char *mountpoint, *base, *path, *ext;
+static char* mountpoint, *base, *path, *ext;
static xg_callback device_s, id_s, path_s, ext_s, base_s, dir_s;
+jmp_buf gdx_jmp_buf;
-void type_s(const char *args, const char **unused)
+void type_s(const char* args, const char** unused)
{
type = strcmp(args, "GPSData");
}
-void device_s(const char *args, const char **unused)
+void device_s(const char* args, const char** unused)
{
if (my_gdx_info) {
fatal(MYNAME ": More than one device type found in file.\n");
my_gdx_info->device_desc = xstrdup(args);
}
-void id_s(const char *args, const char **unused)
+void id_s(const char* args, const char** unused)
{
my_gdx_info->device_id = xstrdup(args);
}
-void path_s(const char *args, const char **unused)
+void path_s(const char* args, const char** unused)
{
path = xstrdup(args);
}
-void ext_s(const char *args, const char **unused)
+void ext_s(const char* args, const char** unused)
{
ext = xstrdup(args);
}
-void base_s(const char *args, const char **unused)
+void base_s(const char* args, const char** unused)
{
base = xstrdup(args);
}
-void dir_s(const char *args, const char **unused)
+void dir_s(const char* args, const char** unused)
{
if (type) {
return;
{ 0, (xg_cb_type) 0, NULL }
};
-const gdx_info *
-gdx_read(const char *fname)
+const gdx_info*
+gdx_read(const char* fname)
{
// Test file open-able before gb_open gets a chance to fatal().
- FILE *fin = fopen(fname, "r");
+ FILE* fin = fopen(fname, "r");
if (fin) {
fclose(fin);
// Look for the Device in the incoming NULL-terminated list of directories
-const gdx_info *
-gdx_find_file(char **dirlist)
+const gdx_info*
+gdx_find_file(char** dirlist)
{
- const gdx_info *gdx;
+ const gdx_info* gdx;
while (dirlist && *dirlist) {
- char *tbuf;
+ char* tbuf;
xasprintf(&tbuf, "%s/%s", *dirlist, "/Garmin/GarminDevice.xml");
mountpoint = *dirlist;
gdx = gdx_read(tbuf);
return NULL;
}
-const gdx_info *
+const gdx_info*
gdx_get_info()
{
return my_gdx_info;
* Describes a file on the unit.
*/
typedef struct {
- char *path;
- char *basename;
- char *extension;
- char *canon; // full name, when applicable.
+ char* path;
+ char* basename;
+ char* extension;
+ char* canon; // full name, when applicable.
} gdx_file;
/*
* The interesting traits of this device.
*/
typedef struct {
- const char *device_desc;
- const char *device_id;
- const char *device_mounted_path; // Not from the file; about the file.
+ const char* device_desc;
+ const char* device_id;
+ const char* device_mounted_path; // Not from the file; about the file.
gdx_file from_device;
gdx_file to_device;
// gdx_file geocache_logs;
} gdx_info;
-const gdx_info* gdx_read(const char *fname);
-const gdx_info * gdx_get_info(void);
-const gdx_info * gdx_find_file(char **dirlist);
+const gdx_info* gdx_read(const char* fname);
+const gdx_info* gdx_get_info(void);
+const gdx_info* gdx_find_file(char** dirlist);
// This is so gross. By the time we know it's not a USB device
// and could be one of our devices, we're so deep into the callstack
// (Mac|Lin|Win) x (USB|Serial) matrix. Since we don't *really* want
// to progress any further, we just longjump back to the caller...
#include <setjmp.h>
-jmp_buf gdx_jmp_buf;
+extern jmp_buf gdx_jmp_buf;
#if 0
gpx_global_entry urlname;
gpx_global_entry keywords;
/* time and bounds aren't here; they're recomputed. */
-} *gpx_global ;
+}* gpx_global ;
static void
-gpx_add_to_global(gpx_global_entry *ge, char *cdata)
+gpx_add_to_global(gpx_global_entry* ge, char* cdata)
{
- queue *elem, *tmp;
- gpx_global_entry * gep;
+ queue* elem, *tmp;
+ gpx_global_entry* gep;
QUEUE_FOR_EACH(&ge->queue, elem, tmp) {
gep = BASE_STRUCT(elem, gpx_global_entry, queue);
}
static void
-gpx_rm_from_global(gpx_global_entry *ge)
+gpx_rm_from_global(gpx_global_entry* ge)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&ge->queue, elem, tmp) {
- gpx_global_entry *g = (gpx_global_entry *) dequeue(elem);
+ gpx_global_entry* g = (gpx_global_entry*) dequeue(elem);
xfree(g->tagdata);
xfree(g);
}
}
static void
-gpx_write_gdata(gpx_global_entry *ge, char *tag)
+gpx_write_gdata(gpx_global_entry* ge, char* tag)
{
- queue *elem, *tmp;
- gpx_global_entry * gep;
+ queue* elem, *tmp;
+ gpx_global_entry* gep;
if (!gpx_global || QUEUE_EMPTY(&ge->queue)) {
return;
typedef struct tag_mapping {
tag_type tag_type; /* enum from above for this tag */
int tag_passthrough; /* true if we don't generate this */
- const char *tag_name; /* xpath-ish tag name */
+ const char* tag_name; /* xpath-ish tag name */
unsigned long crc; /* Crc32 of tag_name */
} tag_mapping;
};
static tag_type
-get_tag(const char *t, int *passthrough)
+get_tag(const char* t, int* passthrough)
{
- tag_mapping *tm;
+ tag_mapping* tm;
unsigned long tcrc = get_crc32_s(t);
for (tm = tag_path_map; tm->tag_type != 0; tm++) {
static void
prescan_tags(void)
{
- tag_mapping *tm;
+ tag_mapping* tm;
for (tm = tag_path_map; tm->tag_type != 0; tm++) {
tm->crc = get_crc32_s(tm->tag_name);
}
}
static void
-tag_gpx(const char **attrv)
+tag_gpx(const char** attrv)
{
- const char **avp;
+ const char** avp;
for (avp = &attrv[0]; *avp; avp += 2) {
if (strcmp(avp[0], "version") == 0) {
gpx_version = avp[1];
}
static void
-tag_wpt(const char **attrv)
+tag_wpt(const char** attrv)
{
- const char **avp = &attrv[0];
+ const char** avp = &attrv[0];
wpt_tmp = waypt_new();
}
static void
-tag_cache_desc(const char ** attrv)
+tag_cache_desc(const char** attrv)
{
- const char **avp;
+ const char** avp;
cache_descr_is_html = 0;
for (avp = &attrv[0]; *avp; avp+=2) {
}
static void
-tag_gs_cache(const char **attrv)
+tag_gs_cache(const char** attrv)
{
- const char **avp;
+ const char** avp;
for (avp = &attrv[0]; *avp; avp+=2) {
if (strcmp(avp[0], "id") == 0) {
}
static void
-start_something_else(const char *el, const char **attrv)
+start_something_else(const char* el, const char** attrv)
{
- const char **avp = attrv;
- char **avcp = NULL;
+ const char** avp = attrv;
+ char** avcp = NULL;
int attr_count = 0;
- xml_tag *new_tag;
- fs_xml *fs_gpx;
+ xml_tag* new_tag;
+ fs_xml* fs_gpx;
if (!fs_ptr) {
return;
}
- new_tag = (xml_tag *)xcalloc(sizeof(xml_tag),1);
+ new_tag = (xml_tag*)xcalloc(sizeof(xml_tag),1);
new_tag->tagname = xstrdup(el);
/* count attributes */
/* copy attributes */
avp = attrv;
- new_tag->attributes = (char **)xcalloc(sizeof(char *),attr_count+1);
+ new_tag->attributes = (char**)xcalloc(sizeof(char*),attr_count+1);
avcp = new_tag->attributes;
while (*avp) {
*avcp = xstrdup(*avp);
new_tag->parent = cur_tag;
}
} else {
- fs_gpx = (fs_xml *)fs_chain_find(*fs_ptr, FS_GPX);
+ fs_gpx = (fs_xml*)fs_chain_find(*fs_ptr, FS_GPX);
if (fs_gpx && fs_gpx->tag) {
cur_tag = fs_gpx->tag;
} else {
fs_gpx = fs_xml_alloc(FS_GPX);
fs_gpx->tag = new_tag;
- fs_chain_add(fs_ptr, (format_specific_data *)fs_gpx);
+ fs_chain_add(fs_ptr, (format_specific_data*)fs_gpx);
new_tag->parent = NULL;
}
}
}
static void
-tag_log_wpt(const char **attrv)
+tag_log_wpt(const char** attrv)
{
- waypoint * lwp_tmp;
- const char **avp = &attrv[0];
+ waypoint* lwp_tmp;
+ const char** avp = &attrv[0];
/* create a new waypoint */
lwp_tmp = waypt_new();
}
static void
-gpx_start(void *data, const XML_Char *xml_el, const XML_Char **xml_attr)
+gpx_start(void* data, const XML_Char* xml_el, const XML_Char** xml_attr)
{
- char *e;
- char *ep;
+ char* e;
+ char* ep;
int passthrough;
- const char *el = xml_convert_to_char_string(xml_el);
- const char **attr = xml_convert_attrs_to_char_string(xml_attr);
+ const char* el = xml_convert_to_char_string(xml_el);
+ const char** attr = xml_convert_attrs_to_char_string(xml_attr);
vmem_realloc(¤t_tag, strlen(current_tag.mem) + 2 + strlen(el));
e = current_tag.mem;
struct
gs_type_mapping {
geocache_type type;
- const char *name;
+ const char* name;
} gs_type_map[] = {
{ gt_traditional, "Traditional Cache" },
{ gt_traditional, "Traditional" }, /* opencaching.de */
struct
gs_container_mapping {
geocache_container type;
- const char *name;
+ const char* name;
} gs_container_map[] = {
{ gc_other, "Unknown" },
{ gc_other, "Other" }, /* Synonym on read. */
};
geocache_type
-gs_mktype(const char *t)
+gs_mktype(const char* t)
{
int i;
int sz = sizeof(gs_type_map) / sizeof(gs_type_map[0]);
return gt_unknown;
}
-const char *
+const char*
gs_get_cachetype(geocache_type t)
{
int i;
}
geocache_container
-gs_mkcont(const char *t)
+gs_mkcont(const char* t)
{
int i;
int sz = sizeof(gs_container_map) / sizeof(gs_container_map[0]);
return gc_unknown;
}
-const char *
+const char*
gs_get_container(geocache_container t)
{
int i;
}
time_t
-xml_parse_time(const char *cdatastr, int *microsecs)
+xml_parse_time(const char* cdatastr, int* microsecs)
{
int off_hr = 0;
int off_min = 0;
int off_sign = 1;
- char *offsetstr = NULL;
- char *pointstr = NULL;
+ char* offsetstr = NULL;
+ char* pointstr = NULL;
struct tm tm;
time_t rv = 0;
- char *timestr = xstrdup(cdatastr);
+ char* timestr = xstrdup(cdatastr);
memset(&tm, 0, sizeof(tm));
}
static void
-gpx_end(void *data, const XML_Char *xml_el)
+gpx_end(void* data, const XML_Char* xml_el)
{
- const char *el = xml_convert_to_char_string(xml_el);
- char *s = strrchr(current_tag.mem, '/');
+ const char* el = xml_convert_to_char_string(xml_el);
+ char* s = strrchr(current_tag.mem, '/');
float x;
- char *cdatastrp = cdatastr.mem;
+ char* cdatastrp = cdatastr.mem;
int passthrough;
static time_t gc_log_date;
tag_type tag;
//TODO: implement GPX 1.1 case tt_trk_trkseg_trkpt_link:
//TODO: implement GPX 1.1 case tt_rte_rtept_link:
{
- char *lt = link_text;
+ char* lt = link_text;
if (lt) {
lt = xstrdup(lrtrim(link_text));
}
#if ! HAVE_LIBEXPAT
static void
-gpx_rd_init(const char *fname)
+gpx_rd_init(const char* fname)
{
fatal(MYNAME ": This build excluded GPX support because expat was not installed.\n");
}
#else /* NO_EXPAT */
static void
-gpx_cdata(void *dta, const XML_Char *xml_el, int len)
+gpx_cdata(void* dta, const XML_Char* xml_el, int len)
{
- char *estr;
- int *cdatalen;
- char **cdata;
- xml_tag *tmp_tag;
+ char* estr;
+ int* cdatalen;
+ char** cdata;
+ xml_tag* tmp_tag;
size_t slen = strlen(cdatastr.mem);
- const char *s = xml_convert_to_char_string_n(xml_el, &len);
+ const char* s = xml_convert_to_char_string_n(xml_el, &len);
vmem_realloc(&cdatastr, 1 + len + slen);
- estr = ((char *) cdatastr.mem) + slen;
+ estr = ((char*) cdatastr.mem) + slen;
memcpy(estr, s, len);
estr[len] = 0;
}
static void
-gpx_rd_init(const char *fname)
+gpx_rd_init(const char* fname)
{
if (fname[0]) {
fd = gbfopen(fname, "r", MYNAME);
file_time = 0;
current_tag = vmem_alloc(1, 0);
- *((char *)current_tag.mem) = '\0';
+ *((char*)current_tag.mem) = '\0';
prescan_tags();
XML_SetUnknownEncodingHandler(psr, cet_lib_expat_UnknownEncodingHandler, NULL);
cdatastr = vmem_alloc(1, 0);
- *((char *)cdatastr.mem) = '\0';
+ *((char*)cdatastr.mem) = '\0';
if (!xsi_schema_loc) {
xsi_schema_loc = xstrdup(DEFAULT_XSI_SCHEMA_LOC);
#endif
static void
-gpx_wr_init(const char *fname)
+gpx_wr_init(const char* fname)
{
mkshort_handle = mkshort_new_handle();
#if HAVE_LIBEXPAT
int len;
int done = 0;
- char *buf = xmalloc(MY_CBUF_SZ);
+ char* buf = xmalloc(MY_CBUF_SZ);
int result = 0;
int extra;
* we find it, strip it, then read byte-at-a-time
* until we find a non-entity.
*/
- char *badchar;
- char *semi;
+ char* badchar;
+ char* semi;
int maxentlength = 8;
len = gbfread(buf, 1, MY_CBUF_SZ - maxentlength, fd);
done = gbfeof(fd) || !len;
badchar = strchr(badchar+1, '&');
}
{
- char *hex="0123456789abcdef";
+ char* hex="0123456789abcdef";
badchar = strstr(buf, "&#x");
while (badchar) {
int val = 0;
- char *hexit = badchar+3;
+ char* hexit = badchar+3;
semi = strchr(badchar, ';');
if (semi) {
while (*hexit && *hexit != ';') {
}
static void
-fprint_tag_and_attrs(char *prefix, char *suffix, xml_tag *tag)
+fprint_tag_and_attrs(char* prefix, char* suffix, xml_tag* tag)
{
- char **pa;
+ char** pa;
gbfprintf(ofd, "%s%s", prefix, tag->tagname);
pa = tag->attributes;
if (pa) {
}
static void
-fprint_xml_chain(xml_tag *tag, const waypoint *wpt)
+fprint_xml_chain(xml_tag* tag, const waypoint* wpt)
{
- char *tmp_ent;
+ char* tmp_ent;
while (tag) {
if (!tag->cdata && !tag->child) {
fprint_tag_and_attrs("<", " />", tag);
}
}
-void free_gpx_extras(xml_tag *tag)
+void free_gpx_extras(xml_tag* tag)
{
- xml_tag *next = NULL;
- char **ap;
+ xml_tag* next = NULL;
+ char** ap;
while (tag) {
if (tag->cdata) {
* Handle the grossness of GPX 1.0 vs. 1.1 handling of linky links.
*/
static void
-write_gpx_url(const waypoint *waypointp)
+write_gpx_url(const waypoint* waypointp)
{
- char *tmp_ent;
+ char* tmp_ent;
if (waypointp->url == NULL) {
return;
}
if (gpx_wversion_num > 10) {
- url_link *tail;
- for (tail = (url_link *)&waypointp->url_next; tail; tail = tail->url_next) {
+ url_link* tail;
+ for (tail = (url_link*)&waypointp->url_next; tail; tail = tail->url_next) {
tmp_ent = xml_entitize(tail->url);
gbfprintf(ofd, " <link href=\"%s%s\">\n",
urlbase ? urlbase : "", tmp_ent);
* Order counts.
*/
static void
-gpx_write_common_acc(const waypoint *waypointp, const char *indent)
+gpx_write_common_acc(const waypoint* waypointp, const char* indent)
{
- char *fix = NULL;
+ char* fix = NULL;
switch (waypointp->fix) {
case fix_2d:
}
static void
-gpx_write_common_position(const waypoint *waypointp, const char *indent)
+gpx_write_common_position(const waypoint* waypointp, const char* indent)
{
if (waypointp->altitude != unknown_alt) {
gbfprintf(ofd, "%s<ele>%f</ele>\n",
}
static void
-gpx_write_common_description(const waypoint *waypointp, const char *indent,
- const char *oname)
+gpx_write_common_description(const waypoint* waypointp, const char* indent,
+ const char* oname)
{
write_optional_xml_entity(ofd, indent, "name", oname);
write_optional_xml_entity(ofd, indent, "cmt", waypointp->description);
}
static void
-gpx_waypt_pr(const waypoint *waypointp)
+gpx_waypt_pr(const waypoint* waypointp)
{
- const char *oname;
- char *odesc;
- fs_xml *fs_gpx;
- garmin_fs_t *gmsd; /* gARmIN sPECIAL dATA */
+ const char* oname;
+ char* odesc;
+ fs_xml* fs_gpx;
+ garmin_fs_t* gmsd; /* gARmIN sPECIAL dATA */
/*
* Desparation time, try very hard to get a good shortname
gpx_write_common_description(waypointp, " ", oname);
gpx_write_common_acc(waypointp, " ");
- fs_gpx = (fs_xml *)fs_chain_find(waypointp->fs, FS_GPX);
+ fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX);
gmsd = GMSD_FIND(waypointp);
if (fs_gpx) {
if (! gmsd) {
}
static void
-gpx_track_hdr(const route_head *rte)
+gpx_track_hdr(const route_head* rte)
{
- fs_xml *fs_gpx;
+ fs_xml* fs_gpx;
gbfprintf(ofd, "<trk>\n");
write_optional_xml_entity(ofd, " ", "name", rte->rte_name);
}
gbfprintf(ofd, "<trkseg>\n");
- fs_gpx = (fs_xml *)fs_chain_find(rte->fs, FS_GPX);
+ fs_gpx = (fs_xml*)fs_chain_find(rte->fs, FS_GPX);
if (fs_gpx) {
fprint_xml_chain(fs_gpx->tag, NULL);
}
}
static void
-gpx_track_disp(const waypoint *waypointp)
+gpx_track_disp(const waypoint* waypointp)
{
- fs_xml *fs_gpx;
+ fs_xml* fs_gpx;
gbfprintf(ofd, "<trkpt lat=\"" FLT_FMT_T "\" lon=\"" FLT_FMT_T "\">\n",
waypointp->latitude,
NULL : waypointp->shortname);
gpx_write_common_acc(waypointp, " ");
- fs_gpx = (fs_xml *)fs_chain_find(waypointp->fs, FS_GPX);
+ fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX);
if (fs_gpx) {
fprint_xml_chain(fs_gpx->tag, waypointp);
}
}
static void
-gpx_track_tlr(const route_head *rte)
+gpx_track_tlr(const route_head* rte)
{
gbfprintf(ofd, "</trkseg>\n");
gbfprintf(ofd, "</trk>\n");
}
static void
-gpx_route_hdr(const route_head *rte)
+gpx_route_hdr(const route_head* rte)
{
- fs_xml *fs_gpx;
+ fs_xml* fs_gpx;
gbfprintf(ofd, "<rte>\n");
write_optional_xml_entity(ofd, " ", "name", rte->rte_name);
gbfprintf(ofd, " <number>%d</number>\n", rte->rte_num);
}
- fs_gpx = (fs_xml *)fs_chain_find(rte->fs, FS_GPX);
+ fs_gpx = (fs_xml*)fs_chain_find(rte->fs, FS_GPX);
if (fs_gpx) {
fprint_xml_chain(fs_gpx->tag, NULL);
}
}
static void
-gpx_route_disp(const waypoint *waypointp)
+gpx_route_disp(const waypoint* waypointp)
{
- fs_xml *fs_gpx;
+ fs_xml* fs_gpx;
gbfprintf(ofd, " <rtept lat=\"" FLT_FMT_R "\" lon=\"" FLT_FMT_R "\">\n",
waypointp->latitude,
gpx_write_common_description(waypointp, " ", waypointp->shortname);
gpx_write_common_acc(waypointp, " ");
- fs_gpx = (fs_xml *)fs_chain_find(waypointp->fs, FS_GPX);
+ fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX);
if (fs_gpx) {
fprint_xml_chain(fs_gpx->tag, waypointp);
}
}
static void
-gpx_route_tlr(const route_head *rte)
+gpx_route_tlr(const route_head* rte)
{
gbfprintf(ofd, "</rte>\n");
}
}
static void
-gpx_waypt_bound_calc(const waypoint *waypointp)
+gpx_waypt_bound_calc(const waypoint* waypointp)
{
waypt_add_to_bounds(&all_bounds, waypointp);
}
"xsi:schemaLocation=\"http://www.garmin.com/xmlschemas/GpxExtensions/v3 " \
"http://www.garmin.com/xmlschemas/GpxExtensions/v3/GpxExtensionsv3.xsd"
-garmin_fs_t *
+garmin_fs_t*
garmin_fs_alloc(const int protocol)
{
- garmin_fs_t *result = NULL;
+ garmin_fs_t* result = NULL;
- result = (garmin_fs_t *)xcalloc(1, sizeof(*result));
+ result = (garmin_fs_t*)xcalloc(1, sizeof(*result));
result->fs.type = FS_GMSD;
result->fs.copy = (fs_copy) garmin_fs_copy;
result->fs.destroy = garmin_fs_destroy;
}
void
-garmin_fs_destroy(void *fs)
+garmin_fs_destroy(void* fs)
{
- garmin_fs_t *data = (garmin_fs_t *) fs;
+ garmin_fs_t* data = (garmin_fs_t*) fs;
if (data != NULL) {
- garmin_ilink_t *ilinks;
+ garmin_ilink_t* ilinks;
if (data->addr != NULL) {
xfree(data->addr);
ilinks->ref_count--;
if (ilinks->ref_count <= 0) {
while (ilinks != NULL) {
- garmin_ilink_t *tmp = ilinks;
+ garmin_ilink_t* tmp = ilinks;
ilinks = ilinks->next;
xfree(tmp);
}
}
}
-void garmin_fs_copy(garmin_fs_t **dest, garmin_fs_t *src)
+void garmin_fs_copy(garmin_fs_t** dest, garmin_fs_t* src)
{
if (src == NULL) {
*dest = NULL;
return;
}
- *dest = (garmin_fs_t *) xmalloc(sizeof(*src));
+ *dest = (garmin_fs_t*) xmalloc(sizeof(*src));
/* do not copy interlinks, only increment the refrence counter */
if (src->ilinks != NULL) {
(*dest)->state = (src->state != NULL) ? xstrdup(src->state) : NULL;
}
-void garmin_fs_convert(void *fs)
+void garmin_fs_convert(void* fs)
{
- garmin_fs_t *gmsd = (garmin_fs_t *) fs;
+ garmin_fs_t* gmsd = (garmin_fs_t*) fs;
if (gmsd->addr) {
gmsd->addr = cet_convert_string(gmsd->addr);
/* GPX - out */
void
-garmin_fs_xml_fprint(gbfile *ofd, const waypoint *waypt)
+garmin_fs_xml_fprint(gbfile* ofd, const waypoint* waypt)
{
- const char *phone, *addr;
- garmin_fs_t *gmsd = GMSD_FIND(waypt);
+ const char* phone, *addr;
+ garmin_fs_t* gmsd = GMSD_FIND(waypt);
if (gmsd == NULL) {
return;
gbfprintf(ofd, "%*s<gpxx:Depth>%.6f</gpxx:Depth>\n", space * 2, "", waypt->depth);
}
if (gmsd->flags.display) {
- char *cx;
+ char* cx;
switch (gmsd->display) {
case gt_display_mode_symbol:
cx = "SymbolOnly";
gbfprintf(ofd, "%*s</gpxx:Categories>\n", --space * 2, "");
}
if (*addr) {
- char *str, *tmp;
+ char* str, *tmp;
gbfprintf(ofd, "%*s<gpxx:Address>\n", space++ * 2, "");
if ((str = GMSD_GET(addr, NULL))) {
}
if (*phone) {
- char *tmp = xml_entitize(phone);
+ char* tmp = xml_entitize(phone);
gbfprintf(ofd, "%*s<gpxx:PhoneNumber>%s</gpxx:PhoneNumber>\n", space * 2, "", tmp);
xfree(tmp);
}
}
void
-garmin_fs_xml_convert(const int base_tag, int tag, const char *cdatastr, waypoint *waypt)
+garmin_fs_xml_convert(const int base_tag, int tag, const char* cdatastr, waypoint* waypt)
{
- garmin_fs_t *gmsd;
+ garmin_fs_t* gmsd;
gmsd = GMSD_FIND(waypt);
if (gmsd == NULL) {
gmsd = garmin_fs_alloc(-1);
- fs_chain_add(&waypt->fs, (format_specific_data *) gmsd);
+ fs_chain_add(&waypt->fs, (format_specific_data*) gmsd);
}
tag -= base_tag;
}
unsigned char
-garmin_fs_convert_category(const char *category_name, gbuint16 *category)
+garmin_fs_convert_category(const char* category_name, gbuint16* category)
{
int i;
int cat = 0;
cat = (1 << --i);
} else if (global_opts.inifile != NULL) {
for (i = 0; i < 16; i++) {
- char *c;
+ char* c;
char key[3];
snprintf(key, sizeof(key), "%d", i + 1);
}
unsigned char
-garmin_fs_merge_category(const char *category_name, waypoint *waypt)
+garmin_fs_merge_category(const char* category_name, waypoint* waypt)
{
gbuint16 cat;
- garmin_fs_t *gmsd;
+ garmin_fs_t* gmsd;
if (!garmin_fs_convert_category(category_name, &cat)) {
return 0;
if (gmsd == NULL) {
gmsd = garmin_fs_alloc(-1);
- fs_chain_add(&waypt->fs, (format_specific_data *) gmsd);
+ fs_chain_add(&waypt->fs, (format_specific_data*) gmsd);
}
GMSD_SET(category, cat);
return 1;
}
void
-garmin_fs_garmin_after_read(const GPS_PWay way, waypoint *wpt, const int protoid)
+garmin_fs_garmin_after_read(const GPS_PWay way, waypoint* wpt, const int protoid)
{
- garmin_fs_t *gmsd = NULL;
+ garmin_fs_t* gmsd = NULL;
gmsd = garmin_fs_alloc(protoid);
- fs_chain_add(&wpt->fs, (format_specific_data *) gmsd);
+ fs_chain_add(&wpt->fs, (format_specific_data*) gmsd);
/* nothing happens until gmsd is allocated some lines above */
}
void
-garmin_fs_garmin_before_write(const waypoint *wpt, GPS_PWay way, const int protoid)
+garmin_fs_garmin_before_write(const waypoint* wpt, GPS_PWay way, const int protoid)
{
- garmin_fs_t *gmsd = GMSD_FIND(wpt);
+ garmin_fs_t* gmsd = GMSD_FIND(wpt);
if (gmsd == NULL) {
return;
typedef struct garmin_ilink_s {
int ref_count;
double lat, lon, alt;
- struct garmin_ilink_s *next;
+ struct garmin_ilink_s* next;
} garmin_ilink_t;
typedef struct {
int wpt_class;
gbint32 display;
gbint16 category;
- char *city; /* city name */
- char *facility; /* facility name */
- char *state; /* state */
- char *cc; /* country code */
- char *cross_road; /* Intersection road label */
- char *addr; /* address + number */
- char *country; /* country */
- char *phone_nr; /* phone number */
- char *phone_nr2; /* phone number (2) */
- char *fax_nr; /* fax number */
- char *postal_code; /* postal code */
- char *email; /* email address */
- garmin_ilink_t *ilinks;
+ char* city; /* city name */
+ char* facility; /* facility name */
+ char* state; /* state */
+ char* cc; /* country code */
+ char* cross_road; /* Intersection road label */
+ char* addr; /* address + number */
+ char* country; /* country */
+ char* phone_nr; /* phone number */
+ char* phone_nr2; /* phone number (2) */
+ char* fax_nr; /* fax number */
+ char* postal_code; /* postal code */
+ char* email; /* email address */
+ garmin_ilink_t* ilinks;
#ifdef GMSD_EXPERIMENTAL
char subclass[22];
#endif
} garmin_fs_t, *garmin_fs_p;
-garmin_fs_t *garmin_fs_alloc(const int protocol);
-void garmin_fs_destroy(void *fs);
-void garmin_fs_copy(garmin_fs_t **dest, garmin_fs_t *src);
-void garmin_fs_convert(void *fs);
-char *garmin_fs_xstrdup(const char *src, size_t size);
+garmin_fs_t* garmin_fs_alloc(const int protocol);
+void garmin_fs_destroy(void* fs);
+void garmin_fs_copy(garmin_fs_t** dest, garmin_fs_t* src);
+void garmin_fs_convert(void* fs);
+char* garmin_fs_xstrdup(const char* src, size_t size);
/* for GPX */
-void garmin_fs_xml_convert(const int base_tag, int tag, const char *cdatastr, waypoint *waypt);
-void garmin_fs_xml_fprint(gbfile *ofd, const waypoint *waypt);
+void garmin_fs_xml_convert(const int base_tag, int tag, const char* cdatastr, waypoint* waypt);
+void garmin_fs_xml_fprint(gbfile* ofd, const waypoint* waypt);
/* common garmin_fs utilities */
/* ..convert_category: returns 1=OK; 0=Unable to convert category */
-unsigned char garmin_fs_convert_category(const char *category_name, gbuint16 *category);
+unsigned char garmin_fs_convert_category(const char* category_name, gbuint16* category);
/* ..merge_category: returns 1=OK; 0=Unable to convert category */
-unsigned char garmin_fs_merge_category(const char *category_name, waypoint *waypt);
+unsigned char garmin_fs_merge_category(const char* category_name, waypoint* waypt);
#define GMSD_SECTION_CATEGORIES "Garmin Categories"
-void garmin_fs_garmin_after_read(const GPS_PWay way, waypoint *wpt, const int protoid);
-void garmin_fs_garmin_before_write(const waypoint *wpt, GPS_PWay way, const int protoid);
+void garmin_fs_garmin_after_read(const GPS_PWay way, waypoint* wpt, const int protoid);
+void garmin_fs_garmin_before_write(const waypoint* wpt, GPS_PWay way, const int protoid);
#endif
#define GPI_ADDR_POSTAL_CODE 8
#define GPI_ADDR_ADDR 16
-static char *opt_cat, *opt_pos, *opt_notes, *opt_hide_bitmap, *opt_descr, *opt_bitmap;
-static char *opt_unique, *opt_alerts, *opt_units, *opt_speed, *opt_proximity, *opt_sleep;
+static char* opt_cat, *opt_pos, *opt_notes, *opt_hide_bitmap, *opt_descr, *opt_bitmap;
+static char* opt_unique, *opt_alerts, *opt_units, *opt_speed, *opt_proximity, *opt_sleep;
static double defspeed, defproximity;
static int alerts;
time_t crdate; /* creation date and time */
char POI[4]; /* "POI" */
char S8[3];
- char *group;
- char *category;
+ char* group;
+ char* category;
} reader_data_t;
typedef struct writer_data_s {
int sz;
int alert;
bounds bds;
- struct writer_data_s *top_left;
- struct writer_data_s *top_right;
- struct writer_data_s *buttom_left;
- struct writer_data_s *buttom_right;
+ struct writer_data_s* top_left;
+ struct writer_data_s* top_right;
+ struct writer_data_s* buttom_left;
+ struct writer_data_s* buttom_right;
} writer_data_t;
typedef struct gpi_waypt_data_s {
int sz;
- char *addr;
- char *postal_code;
+ char* addr;
+ char* postal_code;
} gpi_waypt_data_t;
typedef struct {
int alerts;
short mask;
char addr_is_dynamic;
- char *addr;
- char *city;
- char *country;
- char *phone_nr;
- char *postal_code;
- char *state;
+ char* addr;
+ char* city;
+ char* country;
+ char* phone_nr;
+ char* postal_code;
+ char* state;
} gpi_waypt_t;
-static gbfile *fin, *fout;
+static gbfile* fin, *fout;
static gbint16 codepage; /* code-page, i.e. 1252 */
-static reader_data_t *rdata;
-static writer_data_t *wdata;
+static reader_data_t* rdata;
+static writer_data_t* wdata;
static short_handle short_h;
static char units;
static time_t gpi_timestamp = 0;
*******************************************************************************/
/* look for or initialize GMSD */
-static garmin_fs_t *
-gpi_gmsd_init(waypoint *wpt)
+static garmin_fs_t*
+gpi_gmsd_init(waypoint* wpt)
{
- garmin_fs_t *gmsd = GMSD_FIND(wpt);
+ garmin_fs_t* gmsd = GMSD_FIND(wpt);
if (wpt == NULL) {
fatal(MYNAME ": Error in file structure.\n");
}
if (gmsd == NULL) {
gmsd = garmin_fs_alloc(-1);
- fs_chain_add(&wpt->fs, (format_specific_data *) gmsd);
+ fs_chain_add(&wpt->fs, (format_specific_data*) gmsd);
}
return gmsd;
}
/* read a standard string with or without 'EN' (or whatever) header */
-static char *
-gpi_read_string(const char *field)
+static char*
+gpi_read_string(const char* field)
{
int l1;
- char *res = NULL;
+ char* res = NULL;
l1 = gbfgetint16(fin);
if (l1 > 0) {
if ((en[0] < 'A') || (en[0] > 'Z') || (en[1] < 'A') || (en[1] > 'Z')) {
fatal(MYNAME ": Invalid country code!\n");
}
- res = xmalloc(l2 + 1);
+ res = (char*) xmalloc(l2 + 1);
res[l2] = '\0';
PP;
if (l2 > 0) {
gbfread(res, 1, l2, fin);
}
} else {
- res = xmalloc(l1 + 1);
+ res = (char*) xmalloc(l1 + 1);
*res = first;
*(res + l1) = '\0';
PP;
}
/* gpi tag handler */
-static int read_tag(const char *caller, const int tag, waypoint *wpt);
+static int read_tag(const char* caller, const int tag, waypoint* wpt);
/* read a single poi with all options */
read_poi(const int sz, const int tag)
{
int pos, len;
- waypoint *wpt;
+ waypoint* wpt;
#ifdef GPI_DBG
PP;
// length field)
/* gpi tag handler */
static int
-read_tag(const char *caller, const int tag, waypoint *wpt)
+read_tag(const char* caller, const int tag, waypoint* wpt)
{
int pos, sz, dist;
double speed;
short mask;
- char *str;
- garmin_fs_t *gmsd;
+ char* str;
+ garmin_fs_t* gmsd;
sz = gbfgetint32(fin);
pos = gbftell(fin);
#ifdef GPI_DBG
{
int x;
- unsigned char *b = xmalloc(sz);
+ unsigned char* b = xmalloc(sz);
fprintf(stderr, "Tag: %x\n", tag);
gbfread(b, 1, sz, fin);
fprintf(stderr, "\n");
*******************************************************************************/
static void
-write_string(const char *str, const char long_format)
+write_string(const char* str, const char long_format)
{
int len;
static int
-compare_wpt_cb(const queue *a, const queue *b)
+compare_wpt_cb(const queue* a, const queue* b)
{
- const waypoint *wa = (waypoint *) a;
- const waypoint *wb = (waypoint *) b;
+ const waypoint* wa = (waypoint*) a;
+ const waypoint* wb = (waypoint*) b;
return strcmp(wa->shortname, wb->shortname);
}
static char
-compare_strings(const char *s1, const char *s2)
+compare_strings(const char* s1, const char* s2)
{
if (s1 == s2) {
return 0;
}
-static writer_data_t *
+static writer_data_t*
wdata_alloc()
{
- writer_data_t *res;
+ writer_data_t* res;
- res = xcalloc(1, sizeof(*res));
+ res = (writer_data_t*) xcalloc(1, sizeof(*res));
QUEUE_INIT(&res->Q);
waypt_init_bounds(&res->bds);
static void
-wdata_free(writer_data_t *data)
+wdata_free(writer_data_t* data)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&data->Q, elem, tmp) {
- waypoint *wpt = (waypoint *)elem;
+ waypoint* wpt = (waypoint*)elem;
if (wpt->extra_data) {
- gpi_waypt_t *dt = (gpi_waypt_t *) wpt->extra_data;
+ gpi_waypt_t* dt = (gpi_waypt_t*) wpt->extra_data;
if (dt->addr_is_dynamic) {
xfree(dt->addr);
}
static void
-wdata_add_wpt(writer_data_t *data, waypoint *wpt)
+wdata_add_wpt(writer_data_t* data, waypoint* wpt)
{
data->ct++;
ENQUEUE_TAIL(&data->Q, &wpt->Q);
static void
-wdata_check(writer_data_t *data)
+wdata_check(writer_data_t* data)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
double center_lat, center_lon;
if ((data->ct <= WAYPOINTS_PER_BLOCK) ||
center_lat = center_lon = 0;
QUEUE_FOR_EACH(&data->Q, elem, tmp) {
- waypoint *wpt = (waypoint *) elem;
+ waypoint* wpt = (waypoint*) elem;
center_lat += wpt->latitude;
center_lon += wpt->longitude;
}
center_lon /= data->ct;
QUEUE_FOR_EACH(&data->Q, elem, tmp) {
- waypoint *wpt = (waypoint *) elem;
- writer_data_t **ref;
+ waypoint* wpt = (waypoint*) elem;
+ writer_data_t** ref;
if (wpt->latitude < center_lat) {
if (wpt->longitude < center_lon) {
static int
-wdata_compute_size(writer_data_t *data)
+wdata_compute_size(writer_data_t* data)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
int res;
res = 23; /* bounds, ... of tag 0x80008 */
QUEUE_FOR_EACH(&data->Q, elem, tmp) {
- waypoint *wpt = (waypoint *) elem;
- gpi_waypt_t *dt;
- garmin_fs_t *gmsd;
- char *str;
+ waypoint* wpt = (waypoint*) elem;
+ gpi_waypt_t* dt;
+ garmin_fs_t* gmsd;
+ char* str;
res += 12; /* tag/sz/sub-sz */
res += 19; /* poi fixed size */
res += 10; /* tag(4) */
}
- dt = xcalloc(1, sizeof(*dt));
+ dt = (gpi_waypt_t*) xcalloc(1, sizeof(*dt));
wpt->extra_data = dt;
if (alerts) {
- char *pos;
+ char* pos;
if ((pos = strchr(wpt->shortname, '@'))) {
double speed, scale;
static void
-wdata_write(const writer_data_t *data)
+wdata_write(const writer_data_t* data)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
gbfputint32(0x80008, fout);
gbfputint32(data->sz, fout);
gbfputc(data->alert, fout);
QUEUE_FOR_EACH(&data->Q, elem, tmp) {
- char *str;
+ char* str;
int s0, s1;
- waypoint *wpt = (waypoint *)elem;
- gpi_waypt_t *dt = wpt->extra_data;
+ waypoint* wpt = (waypoint*)elem;
+ gpi_waypt_t* dt = (gpi_waypt_t*) wpt->extra_data;
str = wpt->description;
if (! str) {
static void
-write_category(const char *category, const char *image, const int image_sz)
+write_category(const char* category, const char* image, const int image_sz)
{
int sz;
static void
-enum_waypt_cb(const waypoint *ref)
+enum_waypt_cb(const waypoint* ref)
{
- waypoint *wpt;
- char *str;
- queue *elem, *tmp;
+ waypoint* wpt;
+ char* str;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&wdata->Q, elem, tmp) {
- waypoint *cmp = (waypoint *) elem;
+ waypoint* cmp = (waypoint*) elem;
/* sort out nearly equal waypoints */
if ((compare_strings(cmp->shortname, ref->shortname) == 0) &&
static void
-load_bitmap_from_file(const char *fname, char **data, int *data_sz)
+load_bitmap_from_file(const char* fname, char** data, int* data_sz)
{
- gbfile *f;
+ gbfile* f;
int i, sz;
int dest_bpp;
int src_line_sz, dest_line_sz;
bmp_header_t src_h;
- int *color_table = NULL;
- gpi_bitmap_header_t *dest_h;
- char *ptr;
+ int* color_table = NULL;
+ gpi_bitmap_header_t* dest_h;
+ char* ptr;
f = gbfopen_le(fname, "rb", MYNAME);
is_fatal(gbfgetint16(f) != 0x4d42, MYNAME ": No BMP image.");
}
if (src_h.used_colors > 0) {
- color_table = xmalloc(4 * src_h.used_colors);
+ color_table = (int*) xmalloc(4 * src_h.used_colors);
gbfread(color_table, 1, 4 * src_h.used_colors, f);
for (i = 0; i < src_h.used_colors; i++) {
int color = color_table[i];
sz += (src_h.used_colors * 4);
}
- ptr = xmalloc(sz);
- dest_h = (void *)ptr;
+ ptr = (char*) xmalloc(sz);
+ dest_h = (gpi_bitmap_header_t*)ptr;
*data = ptr;
*data_sz = sz;
le_write32(&dest_h->size_2c, (dest_line_sz * src_h.height) + 0x2c);
/* copy and revert order of BMP lines */
- ptr = (void *)dest_h;
+ ptr = (char*)dest_h;
ptr += (sizeof(*dest_h) + (dest_line_sz * (src_h.height - 1)));
if (src_h.bpp == 24) {
/* 24 bpp seems to be not supported, convert to 32 bpp */
for (i = 0; i < src_h.height; i++) {
int j;
- char *p = ptr;
+ char* p = ptr;
for (j = 0; j < src_h.width; j++) {
int color;
}
if (src_h.used_colors > 0) {
- ptr = (void *)dest_h;
+ ptr = (char*)dest_h;
ptr += (sizeof(*dest_h) + (src_h.height * src_line_sz));
for (i = 0; i < src_h.used_colors; i++) {
*******************************************************************************/
static void
-garmin_gpi_rd_init(const char *fname)
+garmin_gpi_rd_init(const char* fname)
{
char cp[8];
fin = gbfopen_le(fname, "rb", MYNAME);
- rdata = xcalloc(1, sizeof(*rdata));
+ rdata = (reader_data_t*) xcalloc(1, sizeof(*rdata));
read_header();
static void
-garmin_gpi_wr_init(const char *fname)
+garmin_gpi_wr_init(const char* fname)
{
char cp[8];
- cet_cs_vec_t *vec;
+ cet_cs_vec_t* vec;
int i;
if (gpi_timestamp != 0) { /* not the first gpi output session */
static void
garmin_gpi_write(void)
{
- char *image;
+ char* image;
int image_sz;
if (strlen(opt_cat) == 0) {
ff_vecs_t garmin_gpi_vecs = {
ff_type_file,
{
- ff_cap_read | ff_cap_write /* waypoints */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */,
ff_cap_none /* tracks */,
ff_cap_none /* routes */
},
};
/* gt_waypt_classes: gdb internal order */
-char *gt_waypt_class_names[] = {
+char* gt_waypt_class_names[] = {
"User Waypoint",
"Airport",
"Intersection",
};
/* gt_display_mode_names: this order is used by most devices */
-char *gt_display_mode_names[] = {
+char* gt_display_mode_names[] = {
"Symbol & Name",
"Symbol",
"Symbol & Description"
};
typedef struct {
- const char *shortname;
- const char *longname;
+ const char* shortname;
+ const char* longname;
grid_type grid;
} grid_mapping_t;
/* gt_mps_datum_names: */
typedef struct {
- const char *jeeps_name;
- const char *mps_name;
+ const char* jeeps_name;
+ const char* mps_name;
} datum_mapping_t;
/* will be continued (when requested) */
};
typedef struct garmin_color_s {
- const char *name;
+ const char* name;
gbint32 rgb;
} garmin_color_t;
}
}
-char *
-gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, int *dynamic)
+char*
+gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, int* dynamic)
{
- icon_mapping_t *i;
+ icon_mapping_t* i;
char custom[] = "Custom 63 ";
if ((garmin_format == GDB) && (icon >= 500) && (icon <= 563)) {
case MAPSOURCE:
case GDB:
if (icon == i->mpssymnum) {
- return (char *)i->icon;
+ return (char*)i->icon;
}
break;
case PCX:
case GARMIN_SERIAL:
if (icon == i->pcxsymnum) {
- return (char *)i->icon;
+ return (char*)i->icon;
}
break;
default:
return DEFAULT_ICON_DESCR;
}
-int gt_find_icon_number_from_desc(const char *desc, garmin_formats_e garmin_format)
+int gt_find_icon_number_from_desc(const char* desc, garmin_formats_e garmin_format)
{
static int find_flag = 0;
- icon_mapping_t *i;
+ icon_mapping_t* i;
int def_icon = DEFAULT_ICON_VALUE;
int n;
*/
if (find_flag == 0) {
- char **prefix;
- char *prefixes[] = {"White ", "Red ", "Green ", "Blue ", "Black ", NULL};
+ char** prefix;
+ char* prefixes[] = {"White ", "Red ", "Green ", "Blue ", "Black ", NULL};
for (prefix = prefixes; *prefix != NULL; prefix++) {
int len = strlen(*prefix);
return def_icon;
}
-const char *
-gt_get_icao_country(const char *cc)
+const char*
+gt_get_icao_country(const char* cc)
{
- gt_country_code_t *x = >_country_codes[0];
+ gt_country_code_t* x = >_country_codes[0];
if ((cc == NULL) || (*cc == '\0')) {
return NULL;
}
do {
- const char *ccx = x->cc;
+ const char* ccx = x->cc;
while (ccx != NULL) {
if (strncmp(ccx, cc, 2) == 0) {
return x->country;
return NULL;
}
-const char *
-gt_get_icao_cc(const char *country, const char *shortname)
+const char*
+gt_get_icao_cc(const char* country, const char* shortname)
{
static char res[3];
- gt_country_code_t *x = >_country_codes[0];
+ gt_country_code_t* x = >_country_codes[0];
if ((country == NULL) || (*country == '\0')) {
- const char *test;
+ const char* test;
if (shortname == NULL) {
return NULL;
}
return res;
}
if (shortname && (strlen(shortname) == 4)) {
- const char *ccx = x->cc;
+ const char* ccx = x->cc;
strncpy(res, shortname, 2);
res[2] = '\0';
}
grid_type
-gt_lookup_grid_type(const char *grid_name, const char *module)
+gt_lookup_grid_type(const char* grid_name, const char* module)
{
- grid_mapping_t *g;
+ grid_mapping_t* g;
for (g = gt_mps_grid_names; (g->shortname); g++) {
if ((case_ignore_strcmp(grid_name, g->shortname) == 0) ||
return grid_unknown; /* (warnings) */
}
-const char *
-gt_get_mps_grid_longname(const grid_type grid, const char *module)
+const char*
+gt_get_mps_grid_longname(const grid_type grid, const char* module)
{
if ((grid < GRID_INDEX_MIN) || (grid > GRID_INDEX_MAX))
fatal("%s: Grid index out of range %d (%d..%d)!",
return gt_mps_grid_names[grid].longname;
}
-const char *
+const char*
gt_get_mps_datum_name(const int datum_index)
{
- char *result;
- datum_mapping_t *d;
+ char* result;
+ datum_mapping_t* d;
result = GPS_Math_Get_Datum_Name(datum_index);
}
int
-gt_lookup_datum_index(const char *datum_str, const char *module)
+gt_lookup_datum_index(const char* datum_str, const char* module)
{
- datum_mapping_t *d;
+ datum_mapping_t* d;
int result;
- const char *name = datum_str;
+ const char* name = datum_str;
for (d = gt_mps_datum_names; (d->jeeps_name); d++) {
if (case_ignore_strcmp(name, d->mps_name) == 0) {
result = GPS_Lookup_Datum_Index(name);
if (result < 0) {
- char *tmp;
+ char* tmp;
xasprintf(&tmp, "%s mean", datum_str);
result = GPS_Lookup_Datum_Index(tmp);
xfree(tmp);
}
gbuint32
-gt_color_value_by_name(const char *name)
+gt_color_value_by_name(const char* name)
{
int i;
}
int
-gt_color_index_by_name(const char *name)
+gt_color_index_by_name(const char* name)
{
int i;
return 0; /* unknown */
}
-const char *
+const char*
gt_color_name(const int garmin_index)
{
if ((garmin_index >= 0) && (garmin_index < GT_COLORS_CT)) {
* cc -DMAKE_TABLE garmin_tables.c fatal.o util.o globals.o -lm
*/
-int cet_utf8_to_ucs4(const char *str, int *bytes, int *value)
+int cet_utf8_to_ucs4(const char* str, int* bytes, int* value)
{
fatal("Should not be here.");
}
int
-sortem(const void *a, const void *b)
+sortem(const void* a, const void* b)
{
- const icon_mapping_t *aa = a;
- const icon_mapping_t *bb = b;
+ const icon_mapping_t* aa = a;
+ const icon_mapping_t* bb = b;
// return aa->mpssymnum - bb->mpssymnum;
return strcmp(aa->icon, bb->icon);
main()
{
- icon_mapping_t *i;
+ icon_mapping_t* i;
qsort(garmin_icon_table, sizeof(garmin_icon_table) / sizeof(garmin_icon_table[0]) - 1, sizeof(garmin_icon_table[0]), sortem);
for (i = garmin_icon_table; i->icon; i++) {
// printf("%03d\t%s\n", i->mpssymnum, i->icon);
typedef struct icon_mapping {
const int mpssymnum;
const int pcxsymnum;
- const char *icon;
+ const char* icon;
} icon_mapping_t;
typedef enum {MAPSOURCE, PCX, GARMIN_SERIAL, GDB} garmin_formats_e;
-char *gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, int *dynamic);
-int gt_find_icon_number_from_desc(const char *desc, garmin_formats_e garmin_format);
+char* gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, int* dynamic);
+int gt_find_icon_number_from_desc(const char* desc, garmin_formats_e garmin_format);
extern icon_mapping_t garmin_icon_table[];
gt_waypt_class_map_line
} gt_waypt_classes_e;
-extern char *gt_waypt_class_names[];
+extern char* gt_waypt_class_names[];
typedef struct gt_country_code_s {
- const char *cc;
- const char *country;
+ const char* cc;
+ const char* country;
} gt_country_code_t;
extern gt_country_code_t gt_country_codes[];
-const char *gt_get_icao_country(const char *cc);
-const char *gt_get_icao_cc(const char *country, const char *shortname);
+const char* gt_get_icao_country(const char* cc);
+const char* gt_get_icao_cc(const char* country, const char* shortname);
/* this order is used by most devices */
typedef enum {
gt_display_mode_symbol_and_comment
} gt_display_modes_e;
-extern char *gt_display_mode_names[];
+extern char* gt_display_mode_names[];
#define GT_DISPLAY_MODE_MIN gt_display_mode_symbol_and_name
#define GT_DISPLAY_MODE_MAX gt_display_mode_symbol_and_comment
gt_gdb_display_mode_symbol_and_comment
} gt_gdb_display_modes_e;
-unsigned char gt_convert_category(const char *name, int *category);
+unsigned char gt_convert_category(const char* name, int* category);
unsigned char gt_switch_display_mode_value(const unsigned char display_mode, const int protoid, const char device);
-grid_type gt_lookup_grid_type(const char *grid_name, const char *module);
-const char *gt_get_mps_grid_longname(const grid_type grid, const char *module);
-int gt_lookup_datum_index(const char *datum_str, const char *module);
-const char *gt_get_mps_datum_name(const int datum_index);
+grid_type gt_lookup_grid_type(const char* grid_name, const char* module);
+const char* gt_get_mps_grid_longname(const grid_type grid, const char* module);
+int gt_lookup_datum_index(const char* datum_str, const char* module);
+const char* gt_get_mps_datum_name(const int datum_index);
gbuint32 gt_color_value(const int garmin_index);
-gbuint32 gt_color_value_by_name(const char *name);
-int gt_color_index_by_name(const char *name);
+gbuint32 gt_color_value_by_name(const char* name);
+int gt_color_index_by_name(const char* name);
int gt_color_index_by_rgb(const int rgb);
-const char *gt_color_name(const int garmin_index);
+const char* gt_color_name(const int garmin_index);
#endif
unsigned int track_header_written:1;
} gtxt_flags_t;
-static gbfile *fin, *fout;
-static route_head *current_trk, *current_rte;
+static gbfile* fin, *fout;
+static route_head* current_trk, *current_rte;
static int waypoints;
static int routepoints;
-static waypoint **wpt_a;
+static waypoint** wpt_a;
static int wpt_a_ct;
static grid_type grid_index;
static int datum_index;
-static char *datum_str;
+static char* datum_str;
static int current_line;
-static char *date_time_format = NULL;
+static char* date_time_format = NULL;
static int precision = 3;
static time_t utc_offs = 0;
#define MAX_HEADER_FIELDS 36
-static char *header_lines[unknown_header + 1][MAX_HEADER_FIELDS];
+static char* header_lines[unknown_header + 1][MAX_HEADER_FIELDS];
static int header_fields[unknown_header + 1][MAX_HEADER_FIELDS];
static int header_ct[unknown_header + 1];
#define IS_VALID_ALT(a) (((a) != unknown_alt) && ((a) < GARMIN_UNKNOWN_ALT))
#define DUPSTR(a) (((a) != NULL) && ((a)[0] != 0)) ? xstrdup((a)) : NULL
-static char *opt_datum = NULL;
-static char *opt_dist = NULL;
-static char *opt_temp = NULL;
-static char *opt_date_format = NULL;
-static char *opt_time_format = NULL;
-static char *opt_precision = NULL;
-static char *opt_utc = NULL;
-static char *opt_grid = NULL;
+static char* opt_datum = NULL;
+static char* opt_dist = NULL;
+static char* opt_temp = NULL;
+static char* opt_date_format = NULL;
+static char* opt_time_format = NULL;
+static char* opt_precision = NULL;
+static char* opt_utc = NULL;
+static char* opt_grid = NULL;
static
arglist_t garmin_txt_args[] = {
double speed;
double total;
int count;
- waypoint *prev_wpt;
- waypoint *first_wpt;
- waypoint *last_wpt;
+ waypoint* prev_wpt;
+ waypoint* first_wpt;
+ waypoint* last_wpt;
} info_t;
-static info_t *route_info;
+static info_t* route_info;
static int route_idx;
-static info_t *cur_info;
+static info_t* cur_info;
-static char *headers[] = {
+static char* headers[] = {
"Name\tDescription\tType\tPosition\tAltitude\tDepth\tProximity\tTemperature\t"
"Display Mode\tColor\tSymbol\tFacility\tCity\tState\tCountry\t"
"Date Modified\tLink\tCategories",
/* helpers */
-static char *
-get_option_val(char *option, char *def)
+static char*
+get_option_val(char* option, char* def)
{
- char *c = (option != NULL) ? option : def;
+ char* c = (option != NULL) ? option : def;
return c;
}
static void
init_date_and_time_format(void)
{
- char *f, *c;
+ char* f, *c;
f = get_option_val(opt_date_format, DEFAULT_DATE_FORMAT);
date_time_format = convert_human_date_format(f);
}
static void
-convert_datum(const waypoint *wpt, double *dest_lat, double *dest_lon)
+convert_datum(const waypoint* wpt, double* dest_lat, double* dest_lon)
{
double alt;
/* Waypoint preparation */
static void
-enum_waypt_cb(const waypoint *wpt)
+enum_waypt_cb(const waypoint* wpt)
{
garmin_fs_p gmsd;
int wpt_class;
return;
}
for (i = 0; i < wpt_a_ct; i++) { /* check for duplicates */
- waypoint *tmp = wpt_a[i];
+ waypoint* tmp = wpt_a[i];
if (case_ignore_strcmp(tmp->shortname, wpt->shortname) == 0) {
- wpt_a[i] = (waypoint *)wpt;
+ wpt_a[i] = (waypoint*)wpt;
waypoints--;
return;
}
}
- wpt_a[wpt_a_ct++] = (waypoint *)wpt;
+ wpt_a[wpt_a_ct++] = (waypoint*)wpt;
}
}
static int
-sort_waypt_cb(const void *a, const void *b)
+sort_waypt_cb(const void* a, const void* b)
{
- const waypoint *wa = *(waypoint **)a;
- const waypoint *wb = *(waypoint **)b;
+ const waypoint* wa = *(waypoint**)a;
+ const waypoint* wb = *(waypoint**)b;
return case_ignore_strcmp(wa->shortname, wb->shortname);
}
/* common route and track pre-work */
static void
-prework_hdr_cb(const route_head *rte)
+prework_hdr_cb(const route_head* rte)
{
cur_info = &route_info[route_idx];
cur_info->prev_wpt = NULL;
}
static void
-prework_tlr_cb(const route_head *rte)
+prework_tlr_cb(const route_head* rte)
{
cur_info->last_wpt = cur_info->prev_wpt;
route_idx++;
}
static void
-prework_wpt_cb(const waypoint *wpt)
+prework_wpt_cb(const waypoint* wpt)
{
- waypoint *prev = cur_info->prev_wpt;
+ waypoint* prev = cur_info->prev_wpt;
if (prev != NULL) {
cur_info->time += (wpt->creation_time - prev->creation_time);
cur_info->length += waypt_distance_ex(prev, wpt);
} else {
- cur_info->first_wpt = (waypoint *)wpt;
+ cur_info->first_wpt = (waypoint*)wpt;
cur_info->start = wpt->creation_time;
}
- cur_info->prev_wpt = (waypoint *)wpt;
+ cur_info->prev_wpt = (waypoint*)wpt;
cur_info->count++;
routepoints++;
}
/* output helpers */
static void
-print_position(const waypoint *wpt)
+print_position(const waypoint* wpt)
{
int valid = 1;
double lat, lon, north, east;
print_categories(gbuint16 categories)
{
int i, count;
- char *c;
+ char* c;
if (categories == 0) {
return;
}
static void
-print_course(const waypoint *A, const waypoint *B) /* seems to be okay */
+print_course(const waypoint* A, const waypoint* B) /* seems to be okay */
{
if ((A != NULL) && (B != NULL) && (A != B)) {
int course;
}
static void
-print_speed(double *distance, time_t *time)
+print_speed(double* distance, time_t* time)
{
int idist;
double dist = *distance;
- char *unit;
+ char* unit;
if (!gtxt_flags.metric) {
dist = METERS_TO_MILES(dist) * 1000.0;
}
static void
-print_string(const char *fmt, const char *string)
+print_string(const char* fmt, const char* string)
{
- char *c;
- char *buff;
+ char* c;
+ char* buff;
buff = xstrdup(string);
/* remove unwanted characters from source string */
/* main cb's */
static void
-write_waypt(const waypoint *wpt)
+write_waypt(const waypoint* wpt)
{
unsigned char wpt_class;
garmin_fs_p gmsd;
- char *wpt_type;
- char *dspl_mode;
- const char *country;
+ char* wpt_type;
+ char* dspl_mode;
+ const char* country;
double x;
int i, icon, dynamic;
- char *icon_descr;
+ char* icon_descr;
gmsd = GMSD_FIND(wpt);
gbfprintf(fout, "Waypoint\t%s\t", (wpt->shortname) ? wpt->shortname : "");
if (wpt_class <= gt_waypt_class_airport_ndb) {
- char *temp = wpt->notes;
+ char* temp = wpt->notes;
if (temp == NULL) {
if (wpt->description && (strcmp(wpt->description, wpt->shortname) != 0)) {
temp = wpt->description;
}
static void
-route_disp_hdr_cb(const route_head *rte)
+route_disp_hdr_cb(const route_head* rte)
{
- current_trk = (route_head *)rte;
+ current_trk = (route_head*)rte;
cur_info = &route_info[route_idx];
cur_info->prev_wpt = NULL;
cur_info->total = 0;
}
static void
-route_disp_tlr_cb(const route_head *rte)
+route_disp_tlr_cb(const route_head* rte)
{
route_idx++;
}
static void
-route_disp_wpt_cb(const waypoint *wpt)
+route_disp_wpt_cb(const waypoint* wpt)
{
- waypoint *prev = cur_info->prev_wpt;
+ waypoint* prev = cur_info->prev_wpt;
gbfprintf(fout, "Route Waypoint\t");
gbfprintf(fout, "%s\t", wpt->shortname);
gbfprintf(fout, "\r\n");
- cur_info->prev_wpt = (waypoint *)wpt;
+ cur_info->prev_wpt = (waypoint*)wpt;
}
static void
-track_disp_hdr_cb(const route_head *track)
+track_disp_hdr_cb(const route_head* track)
{
cur_info = &route_info[route_idx];
cur_info->prev_wpt = NULL;
cur_info->total = 0;
- current_trk = (route_head *)track;
+ current_trk = (route_head*)track;
if (track->rte_waypt_ct <= 0) {
return;
}
}
static void
-track_disp_tlr_cb(const route_head *track)
+track_disp_tlr_cb(const route_head* track)
{
route_idx++;
}
static void
-track_disp_wpt_cb(const waypoint *wpt)
+track_disp_wpt_cb(const waypoint* wpt)
{
- waypoint *prev = cur_info->prev_wpt;
+ waypoint* prev = cur_info->prev_wpt;
time_t delta;
double dist, depth;
}
gbfprintf(fout, "\r\n");
- cur_info->prev_wpt = (waypoint *)wpt;
+ cur_info->prev_wpt = (waypoint*)wpt;
}
/*******************************************************************************
*******************************************************************************/
static void
-garmin_txt_wr_init(const char *fname)
+garmin_txt_wr_init(const char* fname)
{
- char *grid_str;
+ char* grid_str;
memset(>xt_flags, 0, sizeof(gtxt_flags));
static void
garmin_txt_write(void)
{
- char *grid_str, *c;
- const char *datum_str;
+ char* grid_str, *c;
+ const char* datum_str;
grid_str = xstrdup(gt_get_mps_grid_longname(grid_index, MYNAME));
while ((c = strchr(grid_str, '*'))) {
int i;
wpt_a_ct = 0;
- wpt_a = (waypoint **)xcalloc(waypoints, sizeof(*wpt_a));
+ wpt_a = (waypoint**)xcalloc(waypoints, sizeof(*wpt_a));
waypt_disp_all(enum_waypt_cb);
route_disp_all(NULL, NULL, enum_waypt_cb);
qsort(wpt_a, waypoints, sizeof(*wpt_a), sort_waypt_cb);
gbfprintf(fout, "Header\t%s\r\n\r\n", headers[waypt_header]);
for (i = 0; i < waypoints; i++) {
- waypoint *wpt = wpt_a[i];
+ waypoint* wpt = wpt_a[i];
write_waypt(wpt);
}
xfree(wpt_a);
int i;
for (i = 0; i < MAX_HEADER_FIELDS; i++) {
- char *c = header_lines[ht][i];
+ char* c = header_lines[ht][i];
if (c != NULL) {
xfree(c);
header_lines[ht][i] = NULL;
/* data parsers */
static int
-parse_date_and_time(char *str, time_t *value)
+parse_date_and_time(char* str, time_t* value)
{
struct tm tm;
- char *cerr, *cin;
+ char* cerr, *cin;
memset(&tm, 0, sizeof(tm));
cin = lrtrim(str);
}
static gbuint16
-parse_categories(const char *str)
+parse_categories(const char* str)
{
char buff[256];
gbuint16 val;
gbuint16 res = 0;
- char *cin, *cx;
+ char* cin, *cx;
if (*str == '\0') {
return 0;
}
static int
-parse_temperature(const char *str, double *temperature)
+parse_temperature(const char* str, double* temperature)
{
double value;
unsigned char unit;
static void
parse_header(void)
{
- char *str;
+ char* str;
int column = -1;
free_header(unknown_header);
}
static int
-parse_display(const char *str, int *val)
+parse_display(const char* str, int* val)
{
gt_display_modes_e i;
bind_fields(const header_type ht)
{
int i;
- char *fields, *c;
+ char* fields, *c;
is_fatal((grid_index < 0) || (datum_index < 0), MYNAME ": Incomplete or invalid file header!");
}
for (i = 0; i < header_ct[unknown_header]; i++) {
- char *name;
+ char* name;
int field_no;
name = header_lines[ht][i] = header_lines[unknown_header][i];
header_lines[unknown_header][i] = NULL;
static void
parse_grid(void)
{
- char *str = csv_lineparse(NULL, "\t", "", 1);
+ char* str = csv_lineparse(NULL, "\t", "", 1);
if (str != NULL) {
if (strstr(str, "dd.ddddd") != 0) {
static void
parse_datum(void)
{
- char *str = csv_lineparse(NULL, "\t", "", 1);
+ char* str = csv_lineparse(NULL, "\t", "", 1);
if (str != NULL) {
datum_index = gt_lookup_datum_index(str, MYNAME);
static void
parse_waypoint(void)
{
- char *str;
+ char* str;
int column = -1;
- waypoint *wpt;
+ waypoint* wpt;
garmin_fs_p gmsd = NULL;
bind_fields(waypt_header);
wpt = waypt_new();
gmsd = garmin_fs_alloc(-1);
- fs_chain_add(&wpt->fs, (format_specific_data *) gmsd);
+ fs_chain_add(&wpt->fs, (format_specific_data*) gmsd);
while ((str = csv_lineparse(NULL, "\t", "", column++))) {
int i, dynamic;
static void
parse_route_header(void)
{
- char *str;
+ char* str;
int column = -1;
- route_head *rte;
+ route_head* rte;
rte = route_head_alloc();
static void
parse_track_header(void)
{
- char *str;
+ char* str;
int column = -1;
- route_head *trk;
+ route_head* trk;
bind_fields(track_header);
trk = route_head_alloc();
static void
parse_route_waypoint(void)
{
- char *str;
+ char* str;
int column = -1;
- waypoint *wpt = NULL;
+ waypoint* wpt = NULL;
bind_fields(rtept_header);
static void
parse_track_waypoint(void)
{
- char *str;
+ char* str;
int column = -1;
- waypoint *wpt;
+ waypoint* wpt;
bind_fields(trkpt_header);
wpt = waypt_new();
/***************************************************************/
static void
-garmin_txt_rd_init(const char *fname)
+garmin_txt_rd_init(const char* fname)
{
memset(>xt_flags, 0, sizeof(gtxt_flags));
static void
garmin_txt_read(void)
{
- char *buff;
+ char* buff;
current_line = 0;
while ((buff = gbfgetstr(fin))) {
- char *cin;
+ char* cin;
if ((current_line++ == 0) && fin->unicode) {
cet_convert_init(CET_CHARSET_UTF8, 1);
0xffffff // White
};
-static gbfile *fin;
-static route_head *track;
-static char *opt_xt_ftype = NULL;
-static char *opt_trk_header = NULL;
+static gbfile* fin;
+static route_head* track;
+static char* opt_xt_ftype = NULL;
+static char* opt_trk_header = NULL;
static
arglist_t format_garmin_xt_args[] = {
* %%% Reader callbacks %%% *
*******************************************************************************/
static void
-format_garmin_xt_rd_init(const char *fname)
+format_garmin_xt_rd_init(const char* fname)
{
fin = gbfopen(fname, "rb", MYNAME);
}
}
static gbuint16
-format_garmin_xt_rd_st_attrs(char *p_trk_name, gbuint8 *p_track_color)
+format_garmin_xt_rd_st_attrs(char* p_trk_name, gbuint8* p_track_color)
{
int method = 0;
gbuint16 trackbytes = 0, TrackPoints = 0;
* Function to Decompose track block of STRK_BLOCK_SIZE bytes
*/
static void
-format_garmin_xt_decomp_trk_blk(gbuint8 ii, gbuint8 TrackBlock[], double *Ele, double *Lat, double *Lon, gbuint32 *Time)
+format_garmin_xt_decomp_trk_blk(gbuint8 ii, gbuint8 TrackBlock[], double* Ele, double* Lat, double* Lon, gbuint32* Time)
{
gbuint32 LatLW = 0, LonLW = 0, TimeLW = 0;
double LatF = 0, LonF = 0;
* Decompose Last Waypoint Eleveation
*/
static void
-format_garmin_xt_decomp_last_ele(gbuint8 ii, double *PrevEle, gbuint8 TrackBlock[])
+format_garmin_xt_decomp_last_ele(gbuint8 ii, double* PrevEle, gbuint8 TrackBlock[])
{
gbuint16 PrevEleW;
// Process all tracks one by one
while ((TracksCompleted < NumberOfTracks) && (!gbfeof(fin))) {
- route_head *tmp_track;
- waypoint *wpt;
- char *trk_name;
- trk_name = xmalloc(30);
+ route_head* tmp_track;
+ waypoint* wpt;
+ char* trk_name;
+ trk_name = (char*) xmalloc(30);
// Generate Track Header
trackbytes = format_garmin_xt_rd_st_attrs(trk_name, &trk_color) - 50;
gbuint32 Lat=0, Lon=0;
gbuint32 Tim=0;
double LatF = 0, LonF = 0, AltF = 0;
- waypoint *wpt;
+ waypoint* wpt;
int method = 0;
unsigned char buf[3];
gbint32 num_trackpoints;
/* %%% Zlib file api %%% */
/*******************************************************************************/
-static gbfile *
-gzapi_open(gbfile *self, const char *mode)
+static gbfile*
+gzapi_open(gbfile* self, const char* mode)
{
char openmode[32];
}
if (self->is_pipe) {
- FILE *fd;
+ FILE* fd;
if (self->mode == 'r') {
fd = stdin;
} else {
fd = stdout;
}
SET_BINARY_MODE(fd);
- self->handle.gz = (void **)gzdopen(fileno(fd), openmode);
+ self->handle.gz = (void**)gzdopen(fileno(fd), openmode);
} else {
- self->handle.gz = (void **)gzopen(self->name, openmode);
+ self->handle.gz = (void**)gzopen(self->name, openmode);
}
if (self->handle.gz == NULL) {
}
static int
-gzapi_close(gbfile *self)
+gzapi_close(gbfile* self)
{
return gzclose(self->handle.gz);
}
static int
-gzapi_seek(gbfile *self, gbint32 offset, int whence)
+gzapi_seek(gbfile* self, gbint32 offset, int whence)
{
int result;
}
static gbsize_t
-gzapi_read(void *buf, const gbsize_t size, const gbsize_t members, gbfile *self)
+gzapi_read(void* buf, const gbsize_t size, const gbsize_t members, gbfile* self)
{
int result = 0;
- char *target = (char*) buf;
+ char* target = (char*) buf;
int count = size * members;
if (self->back != -1) {
if ((result < 0) || ((gbsize_t)result < members)) {
int errnum;
- const char *errtxt;
+ const char* errtxt;
errtxt = gzerror(self->handle.gz, &errnum);
}
static gbsize_t
-gzapi_write(const void *buf, const gbsize_t size, const gbsize_t members, gbfile *self)
+gzapi_write(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* self)
{
return gzwrite(self->handle.gz, buf, size * members) / size;
}
static int
-gzapi_flush(gbfile *self)
+gzapi_flush(gbfile* self)
{
return gzflush(self->handle.gz, Z_SYNC_FLUSH);
}
static gbsize_t
-gzapi_tell(gbfile *self)
+gzapi_tell(gbfile* self)
{
gbsize_t result;
}
static int
-gzapi_eof(gbfile *self)
+gzapi_eof(gbfile* self)
{
int res = 0;
}
static int
-gzapi_ungetc(const int c, gbfile *self)
+gzapi_ungetc(const int c, gbfile* self)
{
if (self->back == -1) {
self->back = c;
}
static void
-gzapi_clearerr(gbfile *self)
+gzapi_clearerr(gbfile* self)
{
gzclearerr(self->handle.gz);
}
static int
-gzapi_error(gbfile *self)
+gzapi_error(gbfile* self)
{
int errnum;
/* %%% Standard C file api %%% */
/*******************************************************************************/
-static gbfile *
-stdapi_open(gbfile *self, const char *mode)
+static gbfile*
+stdapi_open(gbfile* self, const char* mode)
{
self->handle.std = xfopen(self->name, mode, self->module);
return self;
}
static int
-stdapi_close(gbfile *self)
+stdapi_close(gbfile* self)
{
return fclose(self->handle.std);
}
static int
-stdapi_seek(gbfile *self, gbint32 offset, int whence)
+stdapi_seek(gbfile* self, gbint32 offset, int whence)
{
int result;
gbsize_t pos = 0;
}
static gbsize_t
-stdapi_read(void *buf, const gbsize_t size, const gbsize_t members, gbfile *self)
+stdapi_read(void* buf, const gbsize_t size, const gbsize_t members, gbfile* self)
{
int errno;
gbsize_t result = fread(buf, size, members, self->handle.std);
}
static gbsize_t
-stdapi_write(const void *buf, const gbsize_t size, const gbsize_t members, gbfile *self)
+stdapi_write(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* self)
{
return fwrite(buf, size, members, self->handle.std);
}
static int
-stdapi_flush(gbfile *self)
+stdapi_flush(gbfile* self)
{
return fflush(self->handle.std);
}
static gbsize_t
-stdapi_tell(gbfile *self)
+stdapi_tell(gbfile* self)
{
return ftell(self->handle.std);
}
static int
-stdapi_eof(gbfile *self)
+stdapi_eof(gbfile* self)
{
return feof(self->handle.std);
}
static int
-stdapi_ungetc(const int c, gbfile *self)
+stdapi_ungetc(const int c, gbfile* self)
{
return ungetc(c, self->handle.std);
}
static void
-stdapi_clearerr(gbfile *self)
+stdapi_clearerr(gbfile* self)
{
clearerr(self->handle.std);
}
static int
-stdapi_error(gbfile *self)
+stdapi_error(gbfile* self)
{
return ferror(self->handle.std);
}
/* %%% Memory stream (memapi) %%% */
/*******************************************************************************/
-static gbfile *
-memapi_open(gbfile *self, const char *mode)
+static gbfile*
+memapi_open(gbfile* self, const char* mode)
{
self->mempos = 0;
self->memsz = 0;
}
static int
-memapi_close(gbfile *self)
+memapi_close(gbfile* self)
{
if (self->handle.mem) {
xfree(self->handle.mem);
}
static int
-memapi_seek(gbfile *self, gbint32 offset, int whence)
+memapi_seek(gbfile* self, gbint32 offset, int whence)
{
long long pos = (int)self->mempos;
}
static gbsize_t
-memapi_read(void *buf, const gbsize_t size, const gbsize_t members, gbfile *self)
+memapi_read(void* buf, const gbsize_t size, const gbsize_t members, gbfile* self)
{
gbsize_t count;
gbsize_t result = (self->memlen - self->mempos) / size;
}
static gbsize_t
-memapi_write(const void *buf, const gbsize_t size, const gbsize_t members, gbfile *self)
+memapi_write(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* self)
{
gbsize_t count;
}
static int
-memapi_flush(gbfile *self)
+memapi_flush(gbfile* self)
{
return 0;
}
static gbsize_t
-memapi_tell(gbfile *self)
+memapi_tell(gbfile* self)
{
return self->mempos;
}
static int
-memapi_eof(gbfile *self)
+memapi_eof(gbfile* self)
{
return (self->mempos == self->memlen);
}
static int
-memapi_ungetc(const int c, gbfile *self)
+memapi_ungetc(const int c, gbfile* self)
{
if (self->mempos == 0) {
return EOF;
}
static void
-memapi_clearerr(gbfile *self)
+memapi_clearerr(gbfile* self)
{
return;
}
static int
-memapi_error(gbfile *self)
+memapi_error(gbfile* self)
{
return 0;
}
* gbfopen: (as xfopen) plus the name of the calling GPSBabel module (MYNAME)
*/
-gbfile *
-gbfopen(const char *filename, const char *mode, const char *module)
+gbfile*
+gbfopen(const char* filename, const char* mode, const char* module)
{
- gbfile *file;
- const char *m;
+ gbfile* file;
+ const char* m;
int len;
file = (gbfile*) xcalloc(1, sizeof(*file));
#else
file->buffsz = 256;
#endif
- file->buff = (char *) xmalloc(file->buffsz);
+ file->buff = (char*) xmalloc(file->buffsz);
return file;
}
* gbfopen_be: as gbfopen, but set the BIG-ENDIAN flag
*/
-gbfile *
-gbfopen_be(const char *filename, const char *mode, const char *module)
+gbfile*
+gbfopen_be(const char* filename, const char* mode, const char* module)
{
- gbfile *result;
+ gbfile* result;
result = gbfopen(filename, mode, module);
result->big_endian = 1;
*/
void
-gbfclose(gbfile *file)
+gbfclose(gbfile* file)
{
if (!file) {
return;
*/
int
-gbfgetc(gbfile *file)
+gbfgetc(gbfile* file)
{
unsigned char c;
* gbfgets: (as fgets)
*/
-char *
-gbfgets(char *buf, int len, gbfile *file)
+char*
+gbfgets(char* buf, int len, gbfile* file)
{
- char *result = buf;
+ char* result = buf;
while (--len > 0) {
int c = gbfgetc(file);
break;
}
- *(unsigned char *)buf = (unsigned char)c;
+ *(unsigned char*)buf = (unsigned char)c;
buf++;
if (c == '\r') {
*/
gbsize_t
-gbfread(void *buf, const gbsize_t size, const gbsize_t members, gbfile *file)
+gbfread(void* buf, const gbsize_t size, const gbsize_t members, gbfile* file)
{
if ((size == 0) || (members == 0)) {
return 0;
* gbvfprintf: (as vfprintf)
*/
-int gbvfprintf(gbfile *file, const char *format, va_list ap)
+int gbvfprintf(gbfile* file, const char* format, va_list ap)
{
int len;
*/
int
-gbfprintf(gbfile *file, const char *format, ...)
+gbfprintf(gbfile* file, const char* format, ...)
{
va_list args;
int result;
*/
int
-gbfputc(int c, gbfile *file)
+gbfputc(int c, gbfile* file)
{
unsigned char temp = (unsigned int) c;
*/
int
-gbfputs(const char *s, gbfile *file)
+gbfputs(const char* s, gbfile* file)
{
return gbfwrite(s, 1, strlen(s), file);
}
*/
int
-gbfwrite(const void *buf, const gbsize_t size, const gbsize_t members, gbfile *file)
+gbfwrite(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* file)
{
int result;
*/
int
-gbfflush(gbfile *file)
+gbfflush(gbfile* file)
{
return file->fileflush(file);
}
*/
void
-gbfclearerr(gbfile *file)
+gbfclearerr(gbfile* file)
{
file->fileclearerr(file);
}
*/
int
-gbferror(gbfile *file)
+gbferror(gbfile* file)
{
return file->fileerror(file);
}
*/
void
-gbfrewind(gbfile *file)
+gbfrewind(gbfile* file)
{
(void) gbfseek(file, 0, SEEK_SET);
gbfclearerr(file);
*/
int
-gbfseek(gbfile *file, gbint32 offset, int whence)
+gbfseek(gbfile* file, gbint32 offset, int whence)
{
return file->fileseek(file, offset, whence);
}
*/
gbsize_t
-gbftell(gbfile *file)
+gbftell(gbfile* file)
{
gbsize_t result = file->filetell(file);
if ((signed) result == -1)
*/
int
-gbfeof(gbfile *file)
+gbfeof(gbfile* file)
{
return file->fileeof(file);
}
*/
int
-gbfungetc(const int c, gbfile *file)
+gbfungetc(const int c, gbfile* file)
{
return file->fileungetc(c, file);
}
*/
gbint32
-gbfgetint32(gbfile *file)
+gbfgetint32(gbfile* file)
{
char buf[4];
*/
gbint16
-gbfgetint16(gbfile *file)
+gbfgetint16(gbfile* file)
{
char buf[2];
*/
double
-gbfgetdbl(gbfile *file)
+gbfgetdbl(gbfile* file)
{
char buf[8];
*/
float
-gbfgetflt(gbfile *file)
+gbfgetflt(gbfile* file)
{
char buf[4];
* The result is a temporary allocated entity: use it or free it!
*/
-char *
-gbfgetcstr(gbfile *file)
+char*
+gbfgetcstr(gbfile* file)
{
- char *result;
+ char* result;
int len = 0;
- char *str = file->buff;
+ char* str = file->buff;
for (;;) {
int c = gbfgetc(file);
len++;
}
- result = (char *) xmalloc(len + 1);
+ result = (char*) xmalloc(len + 1);
if (len > 0) {
memcpy(result, str, len);
}
* The result is a temporary allocated entity: use it or free it!
*/
-char *
-gbfgetpstr(gbfile *file)
+char*
+gbfgetpstr(gbfile* file)
{
int len;
- char *result;
+ char* result;
len = gbfgetc(file);
- result = (char *) xmalloc(len + 1);
+ result = (char*) xmalloc(len + 1);
if (len > 0) {
gbfread(result, 1, len, file);
}
return result;
}
-static char *
-gbfgetucs2str(gbfile *file)
+static char*
+gbfgetucs2str(gbfile* file)
{
int len = 0;
- char *result = file->buff;
+ char* result = file->buff;
for (;;) {
char buff[8];
* except xfree and free you can do all possible things with the result
*/
-char *
-gbfgetstr(gbfile *file)
+char*
+gbfgetstr(gbfile* file)
{
int len = 0;
- char *result = file->buff;
+ char* result = file->buff;
if (file->unicode) {
return gbfgetucs2str(file);
*/
int
-gbfputint16(const gbint16 i, gbfile *file)
+gbfputint16(const gbint16 i, gbfile* file)
{
char buf[2];
*/
int
-gbfputint32(const gbint32 i, gbfile *file)
+gbfputint32(const gbint32 i, gbfile* file)
{
char buf[4];
*/
int
-gbfputdbl(const double d, gbfile *file)
+gbfputdbl(const double d, gbfile* file)
{
char buf[8];
*/
int
-gbfputflt(const float f, gbfile *file)
+gbfputflt(const float f, gbfile* file)
{
char buf[4];
*/
int
-gbfputcstr(const char *s, gbfile *file)
+gbfputcstr(const char* s, gbfile* file)
{
int len;
*/
int
-gbfputpstr(const char *s, gbfile *file)
+gbfputpstr(const char* s, gbfile* file)
{
int len;
/* Much more higher level functions */
gbsize_t
-gbfcopyfrom(gbfile *file, gbfile *src, gbsize_t count)
+gbfcopyfrom(gbfile* file, gbfile* src, gbsize_t count)
{
char buf[1024];
gbsize_t copied = 0;
struct gbfile_s;
typedef struct gbfile_s gbfile;
-typedef void (*gbfclearerr_cb)(gbfile *self);
-typedef int (*gbfclose_cb)(gbfile *self);
-typedef int (*gbfeof_cb)(gbfile *self);
-typedef int (*gbferror_cb)(gbfile *self);
-typedef int (*gbfflush_cb)(gbfile *self);
-typedef gbfile* (*gbfopen_cb)(gbfile *self, const char *mode);
-typedef gbsize_t (*gbfread_cb)(void *buf, const gbsize_t size, const gbsize_t members, gbfile *self);
-typedef int (*gbfseek_cb)(gbfile *self, gbint32 offset, int whence);
-typedef gbsize_t (*gbftell_cb)(gbfile *self);
-typedef gbsize_t (*gbfwrite_cb)(const void *buf, const gbsize_t size, const gbsize_t members, gbfile *self);
-typedef int (*gbfungetc_cb)(const int c, gbfile *self);
+typedef void (*gbfclearerr_cb)(gbfile* self);
+typedef int (*gbfclose_cb)(gbfile* self);
+typedef int (*gbfeof_cb)(gbfile* self);
+typedef int (*gbferror_cb)(gbfile* self);
+typedef int (*gbfflush_cb)(gbfile* self);
+typedef gbfile* (*gbfopen_cb)(gbfile* self, const char* mode);
+typedef gbsize_t (*gbfread_cb)(void* buf, const gbsize_t size, const gbsize_t members, gbfile* self);
+typedef int (*gbfseek_cb)(gbfile* self, gbint32 offset, int whence);
+typedef gbsize_t (*gbftell_cb)(gbfile* self);
+typedef gbsize_t (*gbfwrite_cb)(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* self);
+typedef int (*gbfungetc_cb)(const int c, gbfile* self);
typedef struct gbfile_s {
#ifdef DEBUG_MEM
- void *dummy; /* ZERO pointer for stdio oop's */
+ void* dummy; /* ZERO pointer for stdio oop's */
#endif
union {
- FILE *std;
- unsigned char *mem;
+ FILE* std;
+ unsigned char* mem;
#if !ZLIB_INHIBITED
- gzFile *gz;
+ gzFile* gz;
#endif
} handle;
- char *name;
- char *module;
- char *buff; /* static growing buffer, primary used by gbprintf */
+ char* name;
+ char* module;
+ char* buff; /* static growing buffer, primary used by gbprintf */
int buffsz;
char mode;
int back;
} gbfile_t;
-gbfile *gbfopen(const char *filename, const char *mode, const char *module);
-gbfile *gbfopen_be(const char *filename, const char *mode, const char *module);
+gbfile* gbfopen(const char* filename, const char* mode, const char* module);
+gbfile* gbfopen_be(const char* filename, const char* mode, const char* module);
#define gbfopen_le gbfopen
-void gbfclose(gbfile *file);
-
-gbsize_t gbfread(void *buf, const gbsize_t size, const gbsize_t members, gbfile *file);
-int gbfgetc(gbfile *file);
-char *gbfgets(char *buf, int len, gbfile *file);
-
-int gbvfprintf(gbfile *file, const char *format, va_list ap);
-int gbfprintf(gbfile *file, const char *format, ...);
-int gbfputc(int c, gbfile *file);
-int gbfputs(const char *s, gbfile *file);
-int gbfwrite(const void *buf, const gbsize_t size, const gbsize_t members, gbfile *file);
-int gbfflush(gbfile *file);
-
-void gbfclearerr(gbfile *file);
-int gbferror(gbfile *file);
-void gbfrewind(gbfile *file);
-int gbfseek(gbfile *file, gbint32 offset, int whence);
-gbsize_t gbftell(gbfile *file);
-int gbfeof(gbfile *file);
-int gbfungetc(const int c, gbfile *file);
-
-gbint32 gbfgetint32(gbfile *file);
+void gbfclose(gbfile* file);
+
+gbsize_t gbfread(void* buf, const gbsize_t size, const gbsize_t members, gbfile* file);
+int gbfgetc(gbfile* file);
+char* gbfgets(char* buf, int len, gbfile* file);
+
+int gbvfprintf(gbfile* file, const char* format, va_list ap);
+int gbfprintf(gbfile* file, const char* format, ...);
+int gbfputc(int c, gbfile* file);
+int gbfputs(const char* s, gbfile* file);
+int gbfwrite(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* file);
+int gbfflush(gbfile* file);
+
+void gbfclearerr(gbfile* file);
+int gbferror(gbfile* file);
+void gbfrewind(gbfile* file);
+int gbfseek(gbfile* file, gbint32 offset, int whence);
+gbsize_t gbftell(gbfile* file);
+int gbfeof(gbfile* file);
+int gbfungetc(const int c, gbfile* file);
+
+gbint32 gbfgetint32(gbfile* file);
#define gbfgetuint32 (gbuint32)gbfgetint32
-gbint16 gbfgetint16(gbfile *file);
+gbint16 gbfgetint16(gbfile* file);
#define gbfgetuint16 (gbuint16)gbfgetint16
-double gbfgetdbl(gbfile *file); // read a double value
-float gbfgetflt(gbfile *file); // read a float value
-char *gbfgetstr(gbfile *file); // read until any type of line-breaks or EOF
-char *gbfgetpstr(gbfile *file); // read a pascal string
-char *gbfgetcstr(gbfile *file); // read a null terminated string
+double gbfgetdbl(gbfile* file); // read a double value
+float gbfgetflt(gbfile* file); // read a float value
+char* gbfgetstr(gbfile* file); // read until any type of line-breaks or EOF
+char* gbfgetpstr(gbfile* file); // read a pascal string
+char* gbfgetcstr(gbfile* file); // read a null terminated string
-int gbfputint16(const gbint16 i, gbfile *file);
+int gbfputint16(const gbint16 i, gbfile* file);
#define gbfputuint16(a,b) gbfputint16((gbuint16)(a),(b))
-int gbfputint32(const gbint32 i, gbfile *file);
+int gbfputint32(const gbint32 i, gbfile* file);
#define gbfputuint32(a,b) gbfputint32((gbuint32)(a),(b))
-int gbfputdbl(const double d, gbfile *file); // write a double value
-int gbfputflt(const float f, gbfile *file); // write a float value
-int gbfputcstr(const char *s, gbfile *file); // write string including '\0'
-int gbfputpstr(const char *s, gbfile *file); // write as pascal string
+int gbfputdbl(const double d, gbfile* file); // write a double value
+int gbfputflt(const float f, gbfile* file); // write a float value
+int gbfputcstr(const char* s, gbfile* file); // write string including '\0'
+int gbfputpstr(const char* s, gbfile* file); // write as pascal string
-gbsize_t gbfcopyfrom(gbfile *file, gbfile *src, gbsize_t count);
+gbsize_t gbfcopyfrom(gbfile* file, gbfile* src, gbsize_t count);
#endif
#include <assert.h>
#include <stdarg.h>
-void gbser__db(int l, const char *msg, ...)
+void gbser__db(int l, const char* msg, ...)
{
va_list ap;
va_start(ap, msg);
/* Set the serial port speed.
*/
-int gbser_set_speed(void *handle, unsigned speed)
+int gbser_set_speed(void* handle, unsigned speed)
{
return gbser_set_port(handle, speed, 8, 0, 1);
}
* insensitive, spaces are allowed around the commas and omitted
* trailing fields will default to '8', 'N' and '1'
*/
-int gbser_setup(void *handle, const char *spec)
+int gbser_setup(void* handle, const char* spec)
{
unsigned arg[] = { 4800, 8, 0, 1 };
int ap;
/* Return true if there are characters available on the serial port
*/
-int gbser_avail(void *handle)
+int gbser_avail(void* handle)
{
return gbser__fill_buffer(handle, 1, NULL);
}
* bytes will be read. Returns the number of bytes read or gbser_ERROR if an
* error occurs.
*/
-int gbser_read(void *handle, void *buf, unsigned len)
+int gbser_read(void* handle, void* buf, unsigned len)
{
int got = 0;
/* Read the specified number of bytes. Block until the requested number
* of bytes have been read or the timeout (in ms) is exceeded.
*/
-int gbser_read_wait(void *handle, void *buf, unsigned len, unsigned ms)
+int gbser_read_wait(void* handle, void* buf, unsigned len, unsigned ms)
{
int got = 0;
/* Read a single character from the port, returning immediately if
* none are available.
*/
-int gbser_readc(void *handle)
+int gbser_readc(void* handle)
{
unsigned char buf;
int rc;
/* Read a single character from the port, waiting up to |ms|
* milliseconds for a character to be available.
*/
-int gbser_readc_wait(void *handle, unsigned ms)
+int gbser_readc_wait(void* handle, unsigned ms)
{
unsigned char buf;
int rc;
/* Write a null terminated string in |str| to the serial
* port.
*/
-int gbser_print(void *handle, const char *str)
+int gbser_print(void* handle, const char* str)
{
return gbser_write(handle, str, (unsigned) strlen(str));
}
/* Write a single character to the serial port.
*/
-int gbser_writec(void *handle, int c)
+int gbser_writec(void* handle, int c)
{
return gbser_write(handle, &c, 1);
}
* ('com1:') are translated into the equivalent name required by
* WIN32
*/
-void *gbser_init(const char *port_name);
+void* gbser_init(const char* port_name);
/* Close a serial port
*/
-void gbser_deinit(void *handle);
+void gbser_deinit(void* handle);
/* Set the serial port speed.
*/
-int gbser_set_speed(void *handle, unsigned speed);
+int gbser_set_speed(void* handle, unsigned speed);
/* Set the serial port speed, start, parity and stop bits */
-int gbser_set_port(void *handle, unsigned speed,
+int gbser_set_port(void* handle, unsigned speed,
unsigned bits,
unsigned parity,
unsigned stop);
* insensitive, spaces are allowed around the commas and omitted
* trailing fields will default to '8', 'N' and '1'
*/
-int gbser_setup(void *handle, const char *spec);
+int gbser_setup(void* handle, const char* spec);
/* Return true if there are characters available on the serial port
*/
-int gbser_avail(void *handle);
+int gbser_avail(void* handle);
/* Read as many bytes as are available without blocking. At most |len|
* bytes will be read. Returns the number of bytes read or gbser_ERROR if an
* error occurs.
*/
-int gbser_read(void *handle, void *buf, unsigned len);
+int gbser_read(void* handle, void* buf, unsigned len);
/* Read the specified number of bytes. Block until the requested number
* of bytes have been read or the timeout (in ms) is exceeded.
*/
-int gbser_read_wait(void *handle, void *buf, unsigned len, unsigned ms);
+int gbser_read_wait(void* handle, void* buf, unsigned len, unsigned ms);
/* Read from the serial port until the specified |eol| character is
* found. Any character matching |discard| will be discarded. To
* read lines terminated by 0x0A0x0D discarding linefeeds use
* gbser_read_line(h, buf, len, 1000, 0x0D, 0x0A);
*/
-int gbser_read_line(void *handle, void *buf,
+int gbser_read_line(void* handle, void* buf,
unsigned len, unsigned ms,
int eol, int discard);
/* Read a single character from the port, returning immediately if
* none are available. TODO: Define return values
*/
-int gbser_readc(void *handle);
+int gbser_readc(void* handle);
/* Read a single character from the port, waiting up to |ms|
* milliseconds for a character to be available.
*/
-int gbser_readc_wait(void *handle, unsigned ms);
+int gbser_readc_wait(void* handle, unsigned ms);
/* Discard any pending input on the serial port.
*/
-int gbser_flush(void *handle);
+int gbser_flush(void* handle);
/* Write |len| bytes from |buf| to the serial port.
*/
-int gbser_write(void *handle, const void *buf, unsigned len);
+int gbser_write(void* handle, const void* buf, unsigned len);
/* Write a null terminated string in |str| to the serial
* port.
*/
-int gbser_print(void *handle, const char *str);
+int gbser_print(void* handle, const char* str);
/* Write a single character to the serial port.
*/
-int gbser_writec(void *handle, int c);
+int gbser_writec(void* handle, int c);
/* Return true if a port name seems to refer to a serial port.
* On Windows this tests the filename (against the regex
* /^(\\\\\.\\\\)?com\d+:?$/i). On Posix it returns the value of
* isatty()
*/
-int gbser_is_serial(const char *port_name);
+int gbser_is_serial(const char* port_name);
/* This isn't part of the above abstraction; it's just a helper for
* the other serial modules in the tree.
* call to this function.
*/
-const char *fix_win_serial_name_r(const char *comname, char *obuf, size_t len);
-const char *fix_win_serial_name(const char *comname);
+const char* fix_win_serial_name_r(const char* comname, char* obuf, size_t len);
+const char* fix_win_serial_name(const char* comname);
#endif /* GBSER_H */
} gbser_handle;
/* Wrapper to safely cast a void * into a gbser_handle */
-static gbser_handle *gbser__get_handle(void *p)
+static gbser_handle* gbser__get_handle(void* p)
{
- gbser_handle *h = (gbser_handle *) p;
+ gbser_handle* h = (gbser_handle*) p;
assert(h->magic == MYMAGIC);
return h;
}
typedef struct timeval hp_time;
-static void get_time(hp_time *tv)
+static void get_time(hp_time* tv)
{
gettimeofday(tv, NULL);
}
-static double elapsed(hp_time *tv)
+static double elapsed(hp_time* tv)
{
hp_time now;
double ot = (double) tv->tv_sec * 1000 +
return nt - ot;
}
-static int set_rx_timeout(gbser_handle *h, unsigned vmin, unsigned vtime)
+static int set_rx_timeout(gbser_handle* h, unsigned vmin, unsigned vtime)
{
if (vmin > 255) {
vmin = 255;
* ('com1:') are translated into the equivalent name required by
* WIN32
*/
-void *gbser_init(const char *port_name)
+void* gbser_init(const char* port_name)
{
- gbser_handle *h;
+ gbser_handle* h;
gbser__db(4, "gbser_init(\"%s\")\n", port_name);
/* Close a serial port
*/
-void gbser_deinit(void *handle)
+void gbser_deinit(void* handle)
{
- gbser_handle *h = gbser__get_handle(handle);
+ gbser_handle* h = gbser__get_handle(handle);
tcsetattr(h->fd, TCSAFLUSH, &h->old_tio);
close(h->fd);
xfree(h);
}
-int gbser_set_port(void *handle, unsigned speed, unsigned bits, unsigned parity, unsigned stop)
+int gbser_set_port(void* handle, unsigned speed, unsigned bits, unsigned parity, unsigned stop)
{
- gbser_handle *h = gbser__get_handle(handle);
+ gbser_handle* h = gbser__get_handle(handle);
speed_t s;
static unsigned bit_flags[] = {
return tcsetattr(h->fd, TCSADRAIN, &h->new_tio) ? gbser_ERROR : gbser_OK;
}
-unsigned gbser__read_buffer(void *handle, void **buf, unsigned *len)
+unsigned gbser__read_buffer(void* handle, void** buf, unsigned* len)
{
- gbser_handle *h = gbser__get_handle(handle);
+ gbser_handle* h = gbser__get_handle(handle);
unsigned count = *len;
- unsigned char *cp = (unsigned char *) *buf;
+ unsigned char* cp = (unsigned char*) *buf;
if (count > h->inbuf_used) {
count = h->inbuf_used;
}
h->inbuf_used -= count;
*len -= count;
cp += count;
- *buf = (void *) cp;
+ *buf = (void*) cp;
return count;
}
* be updated to indicate the remaining time on exit.
* Returns the number of bytes available (>=0) or an error code (<0).
*/
-int gbser__fill_buffer(void *handle, unsigned want, unsigned *ms)
+int gbser__fill_buffer(void* handle, unsigned want, unsigned* ms)
{
int rc;
- gbser_handle *h = gbser__get_handle(handle);
+ gbser_handle* h = gbser__get_handle(handle);
if (want > BUFSIZE) {
want = BUFSIZE;
/* Discard any pending input on the serial port.
*/
-int gbser_flush(void *handle)
+int gbser_flush(void* handle)
{
- gbser_handle *h = gbser__get_handle(handle);
+ gbser_handle* h = gbser__get_handle(handle);
h->inbuf_used = 0;
if (tcflush(h->fd, TCIFLUSH)) {
return gbser_ERROR;
/* Write |len| bytes from |buf| to the serial port.
*/
-int gbser_write(void *handle, const void *buf, unsigned len)
+int gbser_write(void* handle, const void* buf, unsigned len)
{
- gbser_handle *h = gbser__get_handle(handle);
- const char *bp = (const char *) buf;
+ gbser_handle* h = gbser__get_handle(handle);
+ const char* bp = (const char*) buf;
int rc;
while (len > 0) {
/*printf("write(%d, %p, %d)\n", h->fd, bp, len);*/
* isatty()
*/
-int gbser_is_serial(const char *port_name)
+int gbser_is_serial(const char* port_name)
{
int fd;
int is_port = 0;
* call to this function.
*/
-const char *fix_win_serial_name_r(const char *comname, char *obuf, size_t len)
+const char* fix_win_serial_name_r(const char* comname, char* obuf, size_t len)
{
strncpy(obuf, comname, len);
return obuf;
static char gb_com_buffer[100];
-const char *fix_win_serial_name(const char *comname)
+const char* fix_win_serial_name(const char* comname)
{
return fix_win_serial_name_r(comname, gb_com_buffer, sizeof(gb_com_buffer));
}
* The terminating character and any discarded characters are not
* stored in the buffer.
*/
-int gbser_read_line(void *handle, void *buf, unsigned len, unsigned ms, int eol, int discard)
+int gbser_read_line(void* handle, void* buf, unsigned len, unsigned ms, int eol, int discard)
{
- char *bp = (char *) buf;
+ char* bp = (char*) buf;
unsigned pos = 0;
hp_time tv;
get_time(&tv);
#define MYMAGIC 0x91827364
#define BUFSIZE 512
-void gbser__db(int l, const char *msg, ...);
-int gbser__fill_buffer(void *h, unsigned want, unsigned *ms);
-unsigned gbser__read_buffer(void *handle, void **buf, unsigned *len);
+void gbser__db(int l, const char* msg, ...);
+int gbser__fill_buffer(void* h, unsigned want, unsigned* ms);
+unsigned gbser__read_buffer(void* handle, void** buf, unsigned* len);
#define DEV_PREFIX "\\\\.\\\\"
/* Wrapper to safely cast a void * into a gbser_handle */
-static gbser_handle *gbser__get_handle(void *p)
+static gbser_handle* gbser__get_handle(void* p)
{
- gbser_handle *h = (gbser_handle *) p;
+ gbser_handle* h = (gbser_handle*) p;
assert(h->magic == MYMAGIC);
return h;
}
typedef LARGE_INTEGER hp_time;
-static void get_time(hp_time *tv)
+static void get_time(hp_time* tv)
{
QueryPerformanceCounter(tv);
}
-static double elapsed(hp_time *tv)
+static double elapsed(hp_time* tv)
{
hp_time now;
LARGE_INTEGER tps;
(double) tps.QuadPart) * 1000;
}
-static int set_rx_timeout(gbser_handle *h, DWORD timeout)
+static int set_rx_timeout(gbser_handle* h, DWORD timeout)
{
if (timeout != h->timeout) {
COMMTIMEOUTS to;
* call to this function.
*/
-const char *
-fix_win_serial_name_r(const char *comname, char *obuf, size_t len)
+const char*
+fix_win_serial_name_r(const char* comname, char* obuf, size_t len)
{
if (!gbser_is_serial(comname) ||
((strlen(comname) == 5) && (comname[4] == ':')) ||
static char gb_com_buffer[100];
-const char *fix_win_serial_name(const char *comname)
+const char* fix_win_serial_name(const char* comname)
{
return fix_win_serial_name_r(comname, gb_com_buffer, sizeof(gb_com_buffer));
}
* ('com1:') are translated into the equivalent name required by
* WIN32
*/
-void *gbser_init(const char *port_name)
+void* gbser_init(const char* port_name)
{
HANDLE comport;
gbser_handle* h = xcalloc(1, sizeof(*h));
- const char *xname = fix_win_serial_name(port_name);
+ const char* xname = fix_win_serial_name(port_name);
gbser__db(2, "Translated port name: \"%s\"\n", xname);
/* Close a serial port
*/
-void gbser_deinit(void *handle)
+void gbser_deinit(void* handle)
{
- gbser_handle *h = gbser__get_handle(handle);
+ gbser_handle* h = gbser__get_handle(handle);
CloseHandle(h->comport);
xfree(h);
}
-int gbser_set_port(void *handle, unsigned speed, unsigned bits, unsigned parity, unsigned stop)
+int gbser_set_port(void* handle, unsigned speed, unsigned bits, unsigned parity, unsigned stop)
{
- gbser_handle *h = gbser__get_handle(handle);
+ gbser_handle* h = gbser__get_handle(handle);
DCB tio;
if (bits < 5 || bits > 8) {
return gbser_OK;
}
-unsigned gbser__read_buffer(void *handle, void **buf, unsigned *len)
+unsigned gbser__read_buffer(void* handle, void** buf, unsigned* len)
{
- gbser_handle *h = gbser__get_handle(handle);
+ gbser_handle* h = gbser__get_handle(handle);
unsigned count = *len;
- unsigned char *cp = *buf;
+ unsigned char* cp = *buf;
if (count > h->inbuf_used) {
count = h->inbuf_used;
}
h->inbuf_used -= count;
*len -= count;
cp += count;
- *buf = (void *) cp;
+ *buf = (void*) cp;
return count;
}
* be updated to indicate the remaining time on exit.
* Returns the number of bytes available (>=0) or an error code (<0).
*/
-int gbser__fill_buffer(void *handle, unsigned want, unsigned *ms)
+int gbser__fill_buffer(void* handle, unsigned want, unsigned* ms)
{
int rc;
- gbser_handle *h = gbser__get_handle(handle);
+ gbser_handle* h = gbser__get_handle(handle);
if (want > BUFSIZE) {
want = BUFSIZE;
/* Discard any pending input on the serial port.
*/
-int gbser_flush(void *handle)
+int gbser_flush(void* handle)
{
- gbser_handle *h = gbser__get_handle(handle);
+ gbser_handle* h = gbser__get_handle(handle);
h->inbuf_used = 0;
if (!PurgeComm(h->comport, PURGE_RXCLEAR)) {
return gbser_ERROR;
/* Write |len| bytes from |buf| to the serial port.
*/
-int gbser_write(void *handle, const void *buf, unsigned len)
+int gbser_write(void* handle, const void* buf, unsigned len)
{
- gbser_handle *h = gbser__get_handle(handle);
+ gbser_handle* h = gbser__get_handle(handle);
DWORD nwritten;
- const char *bp = buf;
+ const char* bp = buf;
/* Not sure we need to spin here - but this'll work even if we don't */
while (len > 0) {
if (!WriteFile(h->comport, bp, len, &nwritten, NULL)) {
* isatty()
*/
-int gbser_is_serial(const char *port_name)
+int gbser_is_serial(const char* port_name)
{
- const char *pfx = DEV_PREFIX;
+ const char* pfx = DEV_PREFIX;
size_t pfx_l = strlen(pfx);
- const char *com = "COM";
+ const char* com = "COM";
size_t com_l = strlen(com);
unsigned digits;
* read lines terminated by 0x0A0x0D discarding linefeeds use
* gbser_read_line(h, buf, len, 1000, 0x0D, 0x0A);
*/
-int gbser_read_line(void *handle, void *buf,
+int gbser_read_line(void* handle, void* buf,
unsigned len, unsigned ms,
int eol, int discard)
{
- char *bp = buf;
+ char* bp = buf;
unsigned pos = 0;
hp_time tv;
get_time(&tv);
struct dbfld dbfld[1];
};
-static pdbfile *file_in, *file_out;
-static const char *out_fname;
+static pdbfile* file_in, *file_out;
+static const char* out_fname;
static int ct;
-static char *tbuf = NULL;
-static char *tbufp = NULL;
+static char* tbuf = NULL;
+static char* tbufp = NULL;
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
file_in = pdb_open(fname, MYNAME);
}
}
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
file_out = pdb_create(fname, MYNAME);
out_fname = fname;
static void
data_read(void)
{
-pdbrec_t *pdb_rec;
+pdbrec_t* pdb_rec;
if ((file_in->creator != MYCREATOR) || (file_in->type != MYTYPE)) {
fatal(MYNAME ": Not a GeocachingDB file.\n");
}
for (pdb_rec = file_in->rec_list; pdb_rec; pdb_rec=pdb_rec->next) {
-waypoint *wpt = waypt_new();
-struct dbrec *rec = (struct dbrec *) pdb_rec->data;
+waypoint* wpt = waypt_new();
+struct dbrec* rec = (struct dbrec*) pdb_rec->data;
int nflds;
int length;
int type;
int i;
-char *recdata;
+char* recdata;
int lat_dir = 0;
int lat_deg = 0;
float lat_min = 0.0;
float lon_min = 0.0;
nflds = be_read16(&rec->nflds);
-recdata = (char *) &rec->dbfld[nflds];
+recdata = (char*) &rec->dbfld[nflds];
for (i = 0; i < nflds; i++) {
length = (unsigned short) be_read16(&rec->dbfld[i].fldlen);
static int
-gcdb_add_to_rec(struct dbrec *rec, const char *fldname, gcdb_rectype rectype, void *data)
+gcdb_add_to_rec(struct dbrec* rec, const char* fldname, gcdb_rectype rectype, void* data)
{
int length;
static int rec_cnt;
}
static void
-gcdb_write_wpt(const waypoint *wpt)
+gcdb_write_wpt(const waypoint* wpt)
{
-struct dbrec *rec;
+struct dbrec* rec;
int reclen;
char tbuf[100];
* not the cache creation date.
*/
if (wpt->creation_time) {
-gcdb_add_to_rec(rec, "date", RECTYPE_DATE, (void *) wpt->creation_time);
+gcdb_add_to_rec(rec, "date", RECTYPE_DATE, (void*) wpt->creation_time);
}
#endif
/* static char gdb_release[] = "$Revision: 1.74 $"; */
static char gdb_release_date[] = "$Date: 2011-04-14 01:30:01 $";
-static gbfile *fin, *fout, *ftmp;
+static gbfile* fin, *fout, *ftmp;
static int gdb_ver, gdb_category, gdb_via, gdb_roadbook;
static queue wayptq_in, wayptq_out, wayptq_in_hidden;
static short_handle short_h;
-static char *gdb_opt_category;
-static char *gdb_opt_ver;
-static char *gdb_opt_via;
-static char *gdb_opt_roadbook;
-static char *gdb_opt_bitcategory;
+static char* gdb_opt_category;
+static char* gdb_opt_ver;
+static char* gdb_opt_via;
+static char* gdb_opt_roadbook;
+static char* gdb_opt_bitcategory;
static int waypt_flag;
static int route_flag;
#define NOT_EMPTY(a) (a && *a)
static void
-gdb_flush_waypt_queue(queue *Q)
+gdb_flush_waypt_queue(queue* Q)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(Q, elem, tmp) {
- waypoint *wpt = (waypoint *)elem;
+ waypoint* wpt = (waypoint*)elem;
dequeue(elem);
if (wpt->extra_data) {
xfree(wpt->extra_data);
#if GDB_DEBUG
static void
-disp_summary(const gbfile *f)
+disp_summary(const gbfile* f)
{
int i, len;
#define FREAD_LATLON GPS_Math_Semi_To_Deg(gbfgetint32(fin))
#if GDB_DEBUG
-static char *
-nice(const char *str)
+static char*
+nice(const char* str)
{
- char *res, *env;
- cet_cs_vec_t *vec;
+ char* res, *env;
+ cet_cs_vec_t* vec;
if (!(str && *str)) {
return "";
env = getenv("LANG");
if (env == NULL) {
- return (char *)str;
+ return (char*)str;
}
if ((res = strchr(env, '.'))) {
xfree(res);
return buf;
} else {
- return (char *)str;
+ return (char*)str;
}
}
#endif
-static char *
-gdb_fread_cstr(gbfile *fin)
+static char*
+gdb_fread_cstr(gbfile* fin)
{
- char *result = gbfgetcstr(fin);
+ char* result = gbfgetcstr(fin);
if (result && (*result == '\0')) {
xfree(result);
}
static int
-gdb_fread_str(char *buf, int size, gbfile *fin)
+gdb_fread_str(char* buf, int size, gbfile* fin)
{
char c;
int res = 0;
return res;
}
-static char *
+static char*
gdb_fread_strlist(void)
{
- char *res = NULL;
+ char* res = NULL;
int count;
count = FREAD_i32;
while (count > 0) {
- char *str = FREAD_CSTR;
+ char* str = FREAD_CSTR;
if (str != NULL) {
if (*str && (res == NULL)) {
res = str;
return res;
}
-static waypoint *
-gdb_find_wayptq(const queue *Q, const waypoint *wpt, const char exact)
+static waypoint*
+gdb_find_wayptq(const queue* Q, const waypoint* wpt, const char exact)
{
- queue *elem, *tmp;
- const char *name = wpt->shortname;
+ queue* elem, *tmp;
+ const char* name = wpt->shortname;
QUEUE_FOR_EACH(Q, elem, tmp) {
- waypoint *tmp = (waypoint *)elem;
+ waypoint* tmp = (waypoint*)elem;
if (case_ignore_strcmp(name, tmp->shortname) == 0) {
if (! exact) {
return NULL;
}
-static waypoint *
-gdb_reader_find_waypt(const waypoint *wpt, const char exact)
+static waypoint*
+gdb_reader_find_waypt(const waypoint* wpt, const char exact)
{
- waypoint *res;
+ waypoint* res;
res = gdb_find_wayptq(&wayptq_in, wpt, exact);
if (res == NULL) {
res = gdb_find_wayptq(&wayptq_in_hidden, wpt, exact);
return res;
}
-static waypoint *
-gdb_add_route_waypt(route_head *rte, waypoint *ref, const int wpt_class)
+static waypoint*
+gdb_add_route_waypt(route_head* rte, waypoint* ref, const int wpt_class)
{
- waypoint *tmp, *res;
+ waypoint* tmp, *res;
int turn_point;
tmp = gdb_reader_find_waypt(ref, 1);
#define FWRITE_LATLON(a) gbfputint32(GPS_Math_Deg_To_Semi((a)),fout)
static void
-gdb_write_cstr_list(const char *str)
+gdb_write_cstr_list(const char* str)
{
if NOT_EMPTY(str) {
gbfputint32(1, fout);
reclen = FREAD_i32;
i = FREAD(buf, reclen + 1);
if (global_opts.verbose_status > 0) {
- char *name = buf+2;
+ char* name = buf+2;
if (strstr(name, "SQA") == 0) {
name = "MapSource";
} else if (strstr(name, "neaderhi") == 0) {
/*-----------------------------------------------------------------------------*/
-static waypoint *
-read_waypoint(gt_waypt_classes_e *waypt_class_out)
+static waypoint*
+read_waypoint(gt_waypt_classes_e* waypt_class_out)
{
char buf[128]; /* used for temporary stuff */
int display, icon, dynamic;
gt_waypt_classes_e wpt_class;
int i;
- waypoint *res;
- garmin_fs_t *gmsd;
- char *str;
- char *bufp = buf;
+ waypoint* res;
+ garmin_fs_t* gmsd;
+ char* str;
+ char* bufp = buf;
#ifdef GMSD_EXPERIMENTAL
char subclass[22];
#endif
#if GDB_DEBUG
- char *sn;
+ char* sn;
#endif
waypt_ct++;
res = waypt_new();
gmsd = garmin_fs_alloc(-1);
- fs_chain_add(&res->fs, (format_specific_data *) gmsd);
+ fs_chain_add(&res->fs, (format_specific_data*) gmsd);
res->shortname = FREAD_CSTR;
#if GDB_DEBUG
res->notes = FREAD_CSTR;
#if GDB_DEBUG
DBG(GDB_DBG_WPTe, res->notes) {
- char *str = gstrsub(res->notes, "\r\n", ", ");
+ char* str = gstrsub(res->notes, "\r\n", ", ");
printf(MYNAME "-wpt \"%s\" (%d): notes = %s\n",
sn, wpt_class, nice(str));
xfree(str);
/* VERSION DEPENDENT CODE */
if (gdb_ver <= GDB_VER_2) {
- char *temp;
+ char* temp;
FREAD(buf, 2); /* ?????????????????????????????????? */
waypt_flag = FREAD_C;
url_ct = FREAD_i32;
for (i = url_ct; (i); i--) {
- char *str = FREAD_CSTR;
+ char* str = FREAD_CSTR;
if (str && *str) {
waypt_add_url(res, str, NULL);
#if GDB_DEBUG
/*-----------------------------------------------------------------------------*/
-static route_head *
+static route_head*
read_route(void)
{
- route_head *rte;
+ route_head* rte;
int points, warnings, links, i;
char buf[128];
bounds bounds;
for (i = 0; i < points; i++) {
int wpt_class, j;
char buf[128];
- garmin_ilink_t *il_root, *il_anchor;
+ garmin_ilink_t* il_root, *il_anchor;
- waypoint *wpt;
+ waypoint* wpt;
wpt = waypt_new();
rtept_ct++;
nice(wpt->shortname), wpt_class, links);
#endif
for (j = 0; j < links; j++) {
- garmin_ilink_t *il_step = xmalloc(sizeof(*il_step));
+ garmin_ilink_t* il_step = (garmin_ilink_t*) xmalloc(sizeof(*il_step));
il_step->ref_count = 1;
if (links == 0) {
/* Without links we need all informations from wpt */
- waypoint *tmp = gdb_reader_find_waypt(wpt, 0);
+ waypoint* tmp = gdb_reader_find_waypt(wpt, 0);
if (tmp != NULL) {
waypt_free(wpt);
wpt = waypt_dupe(tmp);
#endif
wpt = gdb_add_route_waypt(rte, wpt, wpt_class);
if (wpt != NULL) {
- garmin_fs_t *gmsd = GMSD_FIND(wpt);
+ garmin_fs_t* gmsd = GMSD_FIND(wpt);
if (gmsd == NULL) {
gmsd = garmin_fs_alloc(-1);
- fs_chain_add(&wpt->fs, (format_specific_data *) gmsd);
+ fs_chain_add(&wpt->fs, (format_specific_data*) gmsd);
}
GMSD_SET(wpt_class, wpt_class);
gmsd->ilinks = il_root;
}
while (il_root) {
- garmin_ilink_t *il = il_root;
+ garmin_ilink_t* il = il_root;
il_root = il_root->next;
xfree(il);
}
#if 0
/* replace CRLF's with ", " */
if (rte->rte_desc) {
- char *c = rte->rte_desc;
+ char* c = rte->rte_desc;
while ((c = strstr(c, "\r\n"))) {
*c++ = ',';
*c++ = ' ';
/*-----------------------------------------------------------------------------*/
-static route_head *
+static route_head*
read_track(void)
{
- route_head *res;
+ route_head* res;
int points, index;
char dummy;
int color_idx;
points = FREAD_i32;
for (index = 0; index < points; index++) {
- waypoint *wpt = waypt_new();
+ waypoint* wpt = waypt_new();
trkpt_ct++;
/*******************************************************************************/
static void
-gdb_rd_init(const char *fname)
+gdb_rd_init(const char* fname)
{
fin = gbfopen_le(fname, "rb", MYNAME);
ftmp = gbfopen_le(NULL, "wb", MYNAME);
static void
read_data(void)
{
- gbfile *fsave;
+ gbfile* fsave;
int incomplete = 0; /* number of incomplete reads */
for (;;) {
int len, delta;
char typ, dump;
gt_waypt_classes_e wpt_class;
- waypoint *wpt;
- route_head *trk, *rte;
+ waypoint* wpt;
+ route_head* trk, *rte;
len = FREAD_i32;
if (FREAD(&typ, 1) < 1) {
case 'W':
wpt = read_waypoint(&wpt_class);
if ((gdb_via == 0) || (wpt_class == 0)) {
- waypoint *dupe;
+ waypoint* dupe;
waypt_add(wpt);
dupe = waypt_dupe(wpt);
ENQUEUE_TAIL(&wayptq_in, &dupe->Q);
}
if (delta > 0) {
int i;
- char *buf = xmalloc(delta);
+ char* buf = (char*) xmalloc(delta);
if (FREAD(buf, delta) < 1) {
fatal(MYNAME ": Attempt to read past EOF.\n");
}
* reset_short_handle: used for waypoint, route and track names
*/
static void
-reset_short_handle(const char *defname)
+reset_short_handle(const char* defname)
{
if (short_h != NULL) {
mkshort_del_handle(&short_h);
write_header(void)
{
char buff[128], tbuff[32];
- char *c;
+ char* c;
int len;
struct tm tm;
*/
static void
-gdb_check_waypt(waypoint *wpt)
+gdb_check_waypt(waypoint* wpt)
{
double lat_orig = wpt->latitude;
double lon_orig = wpt->longitude;
static void
write_waypoint(
- const waypoint *wpt, const char *shortname, garmin_fs_t *gmsd,
+ const waypoint* wpt, const char* shortname, garmin_fs_t* gmsd,
const int icon, const int display)
{
char zbuf[32], ffbuf[32];
/* VERSION DEPENDENT CODE */
if (gdb_ver <= GDB_VER_2) {
- char *descr;
+ char* descr;
FWRITE(zbuf, 3);
FWRITE(zbuf, 4);
FWRITE_CSTR(descr);
} else { /* if (gdb_ver > GDB_VER_3) */
int cnt;
- url_link *url_next;
- const char *str;
+ url_link* url_next;
+ const char* str;
if (wpt_class < gt_waypt_class_map_point) { /* street address */
str = GMSD_GET(addr, "");
/* VERSION DEPENDENT CODE */
if (gdb_ver >= GDB_VER_3) {
- const char *str = GMSD_GET(phone_nr, "");
+ const char* str = GMSD_GET(phone_nr, "");
if (*str) {
FWRITE_i32(1);
FWRITE_CSTR(str);
}
static void
-route_compute_bounds(const route_head *rte, bounds *bounds)
+route_compute_bounds(const route_head* rte, bounds* bounds)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
waypt_init_bounds(bounds);
- QUEUE_FOR_EACH((queue *)&rte->waypoint_list, elem, tmp) {
- waypoint *wpt = (waypoint *)elem;
+ QUEUE_FOR_EACH((queue*)&rte->waypoint_list, elem, tmp) {
+ waypoint* wpt = (waypoint*)elem;
gdb_check_waypt(wpt);
waypt_add_to_bounds(bounds, wpt);
}
}
static void
-route_write_bounds(bounds *bounds)
+route_write_bounds(bounds* bounds)
{
if (waypt_bounds_valid(bounds)) {
FWRITE_C(0);
}
static void
-write_route(const route_head *rte, const char *rte_name)
+write_route(const route_head* rte, const char* rte_name)
{
bounds bounds;
int points, index;
- queue *elem, *tmp;
+ queue* elem, *tmp;
char zbuf[32], ffbuf[32];
memset(zbuf, 0, sizeof(zbuf));
index = 0;
- QUEUE_FOR_EACH((queue *)&rte->waypoint_list, elem, tmp) {
+ QUEUE_FOR_EACH((queue*)&rte->waypoint_list, elem, tmp) {
- waypoint *wpt = (waypoint *)elem;
- waypoint *next = (waypoint *)tmp;
- waypoint *test;
- garmin_fs_t *gmsd = NULL;
+ waypoint* wpt = (waypoint*)elem;
+ waypoint* next = (waypoint*)tmp;
+ waypoint* test;
+ garmin_fs_t* gmsd = NULL;
int wpt_class;
index++;
gmsd = GMSD_FIND(wpt);
/* extra_data may contain a modified shortname */
- FWRITE_CSTR((wpt->extra_data) ? (char *)wpt->extra_data : wpt->shortname);
+ FWRITE_CSTR((wpt->extra_data) ? (char*)wpt->extra_data : wpt->shortname);
wpt_class = wpt->microseconds; /* trick */
}
static void
-write_track(const route_head *trk, const char *trk_name)
+write_track(const route_head* trk, const char* trk_name)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
int points = ELEMENTS(trk);
FWRITE_CSTR(trk_name);
FWRITE_i32(points); /* total number of waypoints in waypoint list */
- QUEUE_FOR_EACH((queue *)&trk->waypoint_list, elem, tmp) {
+ QUEUE_FOR_EACH((queue*)&trk->waypoint_list, elem, tmp) {
double d;
- waypoint *wpt = (waypoint *)elem;
+ waypoint* wpt = (waypoint*)elem;
trkpt_ct++; /* increase informational number of written route points */
/*-----------------------------------------------------------------------------*/
static void
-finalize_item(gbfile *origin, const char identifier)
+finalize_item(gbfile* origin, const char identifier)
{
int len = gbftell(fout);
/*-----------------------------------------------------------------------------*/
static char
-str_not_equal(const char *s1, const char *s2)
+str_not_equal(const char* s1, const char* s2)
{
if (s1) {
if (!s2) {
}
static void
-write_waypoint_cb(const waypoint *refpt)
+write_waypoint_cb(const waypoint* refpt)
{
- garmin_fs_t *gmsd;
- waypoint *test;
- gbfile *fsave;
+ garmin_fs_t* gmsd;
+ waypoint* test;
+ gbfile* fsave;
/* do this when backup always happens in main */
- rtrim(((waypoint *)refpt)->shortname);
+ rtrim(((waypoint*)refpt)->shortname);
test = gdb_find_wayptq(&wayptq_out, refpt, 1);
if ((test != NULL) && (route_flag == 0)) {
if (test == NULL) {
int icon, display, wpt_class;
- char *name;
- waypoint *wpt = waypt_dupe(refpt);
+ char* name;
+ waypoint* wpt = waypt_dupe(refpt);
gdb_check_waypt(wpt);
ENQUEUE_TAIL(&wayptq_out, &wpt->Q);
}
name = mkshort(short_h, name);
- wpt->extra_data = (void *)name;
+ wpt->extra_data = (void*)name;
write_waypoint(wpt, name, gmsd, icon, display);
finalize_item(fsave, 'W');
}
static void
-write_route_cb(const route_head *rte)
+write_route_cb(const route_head* rte)
{
- gbfile *fsave;
- char *name;
+ gbfile* fsave;
+ char* name;
char buf[32];
if (ELEMENTS(rte) <= 0) {
}
static void
-write_track_cb(const route_head *trk)
+write_track_cb(const route_head* trk)
{
- gbfile *fsave;
- char *name;
+ gbfile* fsave;
+ char* name;
char buf[32];
if (ELEMENTS(trk) <= 0) {
/*-----------------------------------------------------------------------------*/
static void
-gdb_wr_init(const char *fname)
+gdb_wr_init(const char* fname)
{
fout = gbfopen_le(fname, "wb", MYNAME);
ftmp = gbfopen_le(NULL, "wb", MYNAME);
#include "defs.h"
#include "xmlgeneric.h"
-static char *deficon = NULL;
-static char *nuke_placer;
+static char* deficon = NULL;
+static char* nuke_placer;
-static waypoint *wpt_tmp;
+static waypoint* wpt_tmp;
-static gbfile *ofd;
+static gbfile* ofd;
static
arglist_t geo_args[] = {
#if ! HAVE_LIBEXPAT
static void
-geo_rd_init(const char *fname)
+geo_rd_init(const char* fname)
{
fatal(MYNAME ": This build excluded GEO support because expat was not installed.\n");
}
{ NULL, (xg_cb_type)0, NULL }
};
-void wpt_s(const char *args, const char **unused)
+void wpt_s(const char* args, const char** unused)
{
wpt_tmp = waypt_new();
/*
wpt_tmp->altitude = 0;
}
-void wpt_e(const char *args, const char **unused)
+void wpt_e(const char* args, const char** unused)
{
waypt_add(wpt_tmp);
}
-void wpt_name_s(const char *args, const char **attrv)
+void wpt_name_s(const char* args, const char** attrv)
{
- const char **avp = &attrv[0];
+ const char** avp = &attrv[0];
while (*avp) {
if (0 == strcmp(avp[0], "id")) {
wpt_tmp->shortname = xstrdup(avp[1]);
}
}
-void wpt_name(const char *args, const char **unused)
+void wpt_name(const char* args, const char** unused)
{
- char *s;
+ char* s;
if (!args) {
return;
}
}
}
-void wpt_link_s(const char *args, const char **attrv)
+void wpt_link_s(const char* args, const char** attrv)
{
- const char **avp = &attrv[0];
+ const char** avp = &attrv[0];
while (*avp) {
if (0 == strcmp(avp[0], "text")) {
wpt_tmp->url_link_text = xstrdup(avp[1]);
avp+=2;
}
}
-void wpt_link(const char *args, const char **attrv)
+void wpt_link(const char* args, const char** attrv)
{
wpt_tmp->url = xstrdup(args);
}
-void wpt_type(const char *args, const char **unused)
+void wpt_type(const char* args, const char** unused)
{
wpt_tmp->wpt_flags.icon_descr_is_dynamic = 1;
wpt_tmp->icon_descr = xstrdup(args);
}
-void wpt_coord(const char *args, const char **attrv)
+void wpt_coord(const char* args, const char** attrv)
{
- const char **avp = &attrv[0];
+ const char** avp = &attrv[0];
while (*avp) {
if (strcmp(avp[0], "lat") == 0) {
}
}
-void wpt_container(const char *args, const char **unused)
+void wpt_container(const char* args, const char** unused)
{
int v;
waypt_alloc_gc_data(wpt_tmp)->container = v;
}
-void wpt_diff(const char *args, const char **unused)
+void wpt_diff(const char* args, const char** unused)
{
if (!args) {
return;
waypt_alloc_gc_data(wpt_tmp)->diff = atof(args) * 10;
}
-void wpt_terr(const char *args, const char **unused)
+void wpt_terr(const char* args, const char** unused)
{
if (!args) {
return;
}
static void
-geo_rd_init(const char *fname)
+geo_rd_init(const char* fname)
{
xml_init(fname, loc_map, NULL);
}
}
static void
-geo_wr_init(const char *fname)
+geo_wr_init(const char* fname)
{
ofd = gbfopen(fname, "w", MYNAME);
}
}
static void
-geo_waypt_pr(const waypoint *waypointp)
+geo_waypt_pr(const waypoint* waypointp)
{
- char *tmp;
+ char* tmp;
gbfprintf(ofd, "<waypoint>\n");
gbfprintf(ofd, "<name id=\"%s\">", waypointp->shortname);
#undef GEONICHE_DBG
-static pdbfile *file_in, *file_out;
-static const char *FilenameOut;
+static pdbfile* file_in, *file_out;
+static const char* FilenameOut;
static int rec_ct;
static int ct;
static char Rec0Magic[] = "68000NV4Q2";
-static char *Arg_dbname = NULL;
-static char *Arg_category = NULL;
+static char* Arg_dbname = NULL;
+static char* Arg_category = NULL;
static
arglist_t Args[] = {
static int GcOffset = 16 * 31 * 31 * 31 - 65536;
static int
-gid2id(char *gid)
+gid2id(char* gid)
{
- char *p;
+ char* p;
int i, val;
if (strncmp(gid, "GC", 2) != 0) {
}
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
file_in = pdb_open(fname, MYNAME);
}
}
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
file_out = pdb_create(fname, MYNAME);
FilenameOut = fname;
ARG_FREE(Arg_category);
}
-static char *
-field(char **pp, int *lenp)
+static char*
+field(char** pp, int* lenp)
{
int len = *lenp;
- char *p = *pp;
- char *dp, *dbuf;
+ char* p = *pp;
+ char* dp, *dbuf;
int state = 0;
if (len == 0 || *p == 0) {
static void
geoniche_read_asc(void)
{
- pdbrec_t *pdb_rec;
+ pdbrec_t* pdb_rec;
/* Process record 0 */
pdb_rec = file_in->rec_list;
- if (strcmp((char *) pdb_rec->data, Rec0Magic)) {
+ if (strcmp((char*) pdb_rec->data, Rec0Magic)) {
fatal(MYNAME ": Bad record 0, not a GeoNiche file.\n");
}
pdb_rec = pdb_rec->next;
/* Process the rest of the records */
for (; pdb_rec; pdb_rec = pdb_rec->next) {
- waypoint *wpt;
- char *vdata;
+ waypoint* wpt;
+ char* vdata;
int vlen;
- char *p;
+ char* p;
int id;
int route_id;
- char *title;
- char *category;
+ char* title;
+ char* category;
double lat, lon, alt;
- char *datestr, *timestr;
+ char* datestr, *timestr;
int icon;
- char *notes;
+ char* notes;
char gid[6+1];
struct tm tm;
if (!wpt) {
fatal(MYNAME ": Couldn't allocate waypoint.\n");
}
- vdata = (char *) pdb_rec->data;
+ vdata = (char*) pdb_rec->data;
vlen = pdb_rec->size;
/* Field 1: Target */
}
}
-static const char *geoniche_icon_map[] = /* MPS */
+static const char* geoniche_icon_map[] = /* MPS */
{
/* 21 */ "Cross",
/* 22 */ "Cross (light)",
/* 52 */ "Mystery or puzzle Cache",
};
-static const char *
+static const char*
geoniche_icon_to_descr(const int no)
{
- const char *result = NULL;
+ const char* result = NULL;
if (no >= 0x21) {
int i = no - 0x21;
static void
geoniche_read_bin(void)
{
- pdbrec_t *pdb_rec;
+ pdbrec_t* pdb_rec;
/* Process records */
for (pdb_rec = file_in->rec_list; pdb_rec != NULL; pdb_rec = pdb_rec->next) {
- char *vdata = (char *) pdb_rec->data;
+ char* vdata = (char*) pdb_rec->data;
struct tm created, visited;
int icon_nr, selected;
int latdeg, londeg;
double lat, lon, altitude;
- waypoint *waypt;
+ waypoint* waypt;
memset(&visited, 0, sizeof(visited));
memset(&created, 0, sizeof(created));
}
}
-static char *
-enscape(char *s)
+static char*
+enscape(char* s)
{
- char *buf, *d;
+ char* buf, *d;
if (!s) {
d = xmalloc(1);
* Attempt to map an icon description into a GeoNiche icon number
*/
static int
-wpt2icon(const waypoint *wpt)
+wpt2icon(const waypoint* wpt)
{
- const char *desc = wpt->icon_descr;
+ const char* desc = wpt->icon_descr;
if (!desc) {
return 0;
return 0;
}
-static char *
-geoniche_geostuff(const waypoint *wpt)
+static char*
+geoniche_geostuff(const waypoint* wpt)
{
- char *gs = NULL, *tmp1, *tmp2, *tmp3;
+ char* gs = NULL, *tmp1, *tmp2, *tmp3;
char tbuf[10240];
if (!wpt->gc_data->terr) {
}
static void
-geoniche_writewpt(const waypoint *wpt)
+geoniche_writewpt(const waypoint* wpt)
{
int vlen;
- char *vdata;
- char *title;
+ char* vdata;
+ char* title;
struct tm tm;
char datestr[10+1];
char timestr[8+1];
- char *notes;
+ char* notes;
int id;
time_t tx;
- char *gs;
+ char* gs;
if (rec_ct == 0) {
pdb_write_rec(file_out, 0, 0, ct++, Rec0Magic, sizeof(Rec0Magic));
#define MYNAME "ggv_log"
-static gbfile *fin, *fout;
+static gbfile* fin, *fout;
static int ggv_log_ver;
static
*******************************************************************************/
static void
-ggv_log_rd_init(const char *fname)
+ggv_log_rd_init(const char* fname)
{
static char magic[32];
int len = 0;
if (cin == '\0') {
double ver = 0;
- char *sver;
+ char* sver;
if (strncmp(magic, "DOMGVGPS Logfile V", 18) != 0) {
break;
}
static void
ggv_log_read(void)
{
- signed char *buf;
+ signed char* buf;
int bufsz = 0, len;
- route_head *trk = NULL;
+ route_head* trk = NULL;
switch (ggv_log_ver) {
case 10:
double xlat, xlon;
float sec;
struct tm tm;
- waypoint *wpt;
+ waypoint* wpt;
if (len != bufsz) {
break;
}
static void
-ggv_log_wr_init(const char *fname)
+ggv_log_wr_init(const char* fname)
{
fout = gbfopen(fname, "wb", MYNAME);
}
static void
-ggv_log_track_head_cb(const route_head *trk)
+ggv_log_track_head_cb(const route_head* trk)
{
- queue *elem, *tmp;
- waypoint *prev = NULL;
+ queue* elem, *tmp;
+ waypoint* prev = NULL;
- QUEUE_FOR_EACH((queue *)&trk->waypoint_list, elem, tmp) {
+ QUEUE_FOR_EACH((queue*)&trk->waypoint_list, elem, tmp) {
double latmin, lonmin, latsec, lonsec;
int latint, lonint;
double course = 0, speed = 0;
struct tm tm;
- waypoint *wpt = (waypoint *)elem;
+ waypoint* wpt = (waypoint*)elem;
double secs = 0;
latint = wpt->latitude;
ff_type_file,
{
ff_cap_none, /* waypoints */
- ff_cap_read | ff_cap_write, /* tracks */
+ (ff_cap)(ff_cap_read | ff_cap_write), /* tracks */
ff_cap_none /* routes */
},
ggv_log_rd_init,
# "zoom":
# "art": line-style
*/
-static inifile_t *inifile;
-static gbfile *fout;
+static inifile_t* inifile;
+static gbfile* fout;
static int symbol_ct; /* Number of symbols written */
static int group_ct; /* Group number during write */
*******************************************************************************/
static void
-ggv_ovl_rd_init(const char *fname)
+ggv_ovl_rd_init(const char* fname)
{
inifile = inifile_init(fname, MYNAME);
if (inifile->unicode) {
switch (type) {
char coord[32];
- waypoint *wpt;
- char *cx;
+ waypoint* wpt;
+ char* cx;
int group;
case OVL_SYMBOL_LINE:
if (points > 0) {
int j;
- route_head *rte, *trk;
+ route_head* rte, *trk;
rte = trk = route_head_alloc();
if (group > 1) {
/* prototypes used in main functions */
-static void waypt_disp_cb(const waypoint *wpt);
-static void track_disp_cb(const route_head *trk);
-static void route_disp_cb(const route_head *rte);
+static void waypt_disp_cb(const waypoint* wpt);
+static void track_disp_cb(const route_head* trk);
+static void route_disp_cb(const route_head* rte);
static void write_bounds(void);
-static void draw_symbol_basics(const OVL_SYMBOL_TYP typ, const int art, const OVL_COLOR_TYP color, const waypoint *wpt);
-static int get_direction(const waypoint *A, const waypoint *B);
+static void draw_symbol_basics(const OVL_SYMBOL_TYP typ, const int art, const OVL_COLOR_TYP color, const waypoint* wpt);
+static int get_direction(const waypoint* A, const waypoint* B);
// static void draw_symbol_text(const char *text, const waypoint *reference);
/* -----------------------------------------------------------------------*/
static void
-ggv_ovl_wr_init(const char *fname)
+ggv_ovl_wr_init(const char* fname)
{
fout = gbfopen(fname, "w", MYNAME);
/**************************************************************************/
static void
-waypt_disp_cb(const waypoint *wpt)
+waypt_disp_cb(const waypoint* wpt)
{
draw_symbol_basics(OVL_SYMBOL_CIRCLE, 1, color, wpt);
gbfprintf(fout, "Width=20\n");
/* -----------------------------------------------------------------------*/
static void
-track_disp_cb(const route_head *trk)
+track_disp_cb(const route_head* trk)
{
int i;
- queue *elem, *tmp;
+ queue* elem, *tmp;
int waypt_ct = trk->rte_waypt_ct;
if (waypt_ct <= 0) {
QUEUE_FOR_EACH(&(trk->waypoint_list), elem, tmp) {
- waypoint *wpt = (waypoint *) elem;
+ waypoint* wpt = (waypoint*) elem;
gbfprintf(fout, "XKoord%d=%0.8f\n", i, wpt->longitude);
gbfprintf(fout, "YKoord%d=%0.8f\n", i, wpt->latitude);
/* -----------------------------------------------------------------------*/
static void
-route_disp_cb(const route_head *rte)
+route_disp_cb(const route_head* rte)
{
int i;
- queue *elem, *tmp;
- waypoint *prev;
+ queue* elem, *tmp;
+ waypoint* prev;
int waypt_ct = rte->rte_waypt_ct;
if (waypt_ct <= 0) {
QUEUE_FOR_EACH(&(rte->waypoint_list), elem, tmp) {
- waypoint *wpt = (waypoint *) elem;
+ waypoint* wpt = (waypoint*) elem;
if (prev != NULL) {
draw_symbol_basics(OVL_SYMBOL_TRIANGLE, 1, 9 /* color */, prev);
/* -----------------------------------------------------------------------*/
static void
-waypt_bound_calc(const waypoint *waypointp)
+waypt_bound_calc(const waypoint* waypointp)
{
waypt_add_to_bounds(&all_bounds, waypointp);
}
}
static void
-draw_symbol_basics(const OVL_SYMBOL_TYP typ, const int art, const OVL_COLOR_TYP color, const waypoint *wpt)
+draw_symbol_basics(const OVL_SYMBOL_TYP typ, const int art, const OVL_COLOR_TYP color, const waypoint* wpt)
{
symbol_ct++;
/* the following code comes from first overlay module */
static int
-get_direction(const waypoint *A, const waypoint *B)
+get_direction(const waypoint* A, const waypoint* B)
{
double lata, lona, latb, lonb;
double dist, dir;
#if 0
static void
-draw_symbol_text(const char *text, const waypoint *reference)
+draw_symbol_text(const char* text, const waypoint* reference)
{
waypoint wpt;
#include "defs.h"
#include "xmlgeneric.h"
-static gbfile *ofd;
-static waypoint *wpt_tmp;
-static route_head *trk_head;
+static gbfile* ofd;
+static waypoint* wpt_tmp;
+static route_head* trk_head;
#define MYNAME "glogbook"
{ gl_trk_long, cb_cdata, "/History/Run/Track/Trackpoint/Position/Longitude" },
{ gl_trk_alt, cb_cdata, "/History/Run/Track/Trackpoint/Position/Altitude" },
{ gl_trk_utc, cb_cdata, "/History/Run/Track/Trackpoint/Time" },
- { NULL, 0, NULL}
+ { NULL, (xg_cb_type)0, NULL}
};
static void
-glogbook_rd_init(const char *fname)
+glogbook_rd_init(const char* fname)
{
xml_init(fname, gl_map, NULL);
}
}
static void
-glogbook_wr_init(const char *fname)
+glogbook_wr_init(const char* fname)
{
ofd = gbfopen(fname, "w", MYNAME);
}
}
static void
-glogbook_waypt_pr(const waypoint *wpt)
+glogbook_waypt_pr(const waypoint* wpt)
{
gbfprintf(ofd, " <Trackpoint>\n");
gbfprintf(ofd, " <Position>\n");
}
static void
-glogbook_hdr(const route_head *rte)
+glogbook_hdr(const route_head* rte)
{
gbfprintf(ofd, " <Track>\n");
}
static void
-glogbook_ftr(const route_head *rte)
+glogbook_ftr(const route_head* rte)
{
gbfprintf(ofd, " </Track>\n");
}
gbfprintf(ofd, "</History>\n");
}
-void gl_trk_s(const char *args, const char **unused)
+void gl_trk_s(const char* args, const char** unused)
{
trk_head = route_head_alloc();
track_add_head(trk_head);
}
#if 0
-void gl_trk_ident(const char *args, const char **unused)
+void gl_trk_ident(const char* args, const char** unused)
{
trk_head->rte_name = xstrdup(args);
}
#endif
-void gl_trk_pnt_s(const char *args, const char **unused)
+void gl_trk_pnt_s(const char* args, const char** unused)
{
wpt_tmp = waypt_new();
}
-void gl_trk_pnt_e(const char *args, const char **unused)
+void gl_trk_pnt_e(const char* args, const char** unused)
{
track_add_wpt(trk_head, wpt_tmp);
}
-void gl_trk_utc(const char *args, const char **unused)
+void gl_trk_utc(const char* args, const char** unused)
{
wpt_tmp->creation_time = xml_parse_time(args, &wpt_tmp->microseconds);
}
-void gl_trk_lat(const char *args, const char **unused)
+void gl_trk_lat(const char* args, const char** unused)
{
wpt_tmp->latitude = atof(args);
}
-void gl_trk_long(const char *args, const char **unused)
+void gl_trk_long(const char* args, const char** unused)
{
wpt_tmp->longitude = atof(args);
}
-void gl_trk_alt(const char *args, const char **unused)
+void gl_trk_alt(const char* args, const char** unused)
{
wpt_tmp->altitude = atof(args);
}
ff_vecs_t glogbook_vecs = {
ff_type_file,
- { ff_cap_none, ff_cap_read | ff_cap_write, ff_cap_none},
+ { ff_cap_none, (ff_cap)(ff_cap_read | ff_cap_write), ff_cap_none},
glogbook_rd_init,
glogbook_wr_init,
glogbook_rd_deinit,
gbuint32 alt;
} gnav_trl_t;
-static gbfile *fin, *fout;
+static gbfile* fin, *fout;
/*******************************************************************************
* %%% global callbacks called by gpsbabel main process %%% *
*******************************************************************************/
static void
-gnav_trl_rd_init(const char *fname)
+gnav_trl_rd_init(const char* fname)
{
fin = gbfopen_le(fname, "rb", MYNAME);
}
static void
-gnav_trl_rw_init(const char *fname)
+gnav_trl_rw_init(const char* fname)
{
fout = gbfopen_le(fname, "wb", MYNAME);
}
}
static double
-read_altitude(void *ptr)
+read_altitude(void* ptr)
{
- unsigned char *i = (unsigned char *) ptr;
+ unsigned char* i = (unsigned char*) ptr;
char buf[sizeof(float)];
le_write32(&buf, i[2] << 24 | i[1] << 16 | i[0] <<8 | i[3]);
return le_read_float(&buf);
}
static void
-write_altitude(void *ptr, const float alt)
+write_altitude(void* ptr, const float alt)
{
char buf[sizeof(float)];
- unsigned char *i = (unsigned char *) &buf;
+ unsigned char* i = (unsigned char*) &buf;
le_write_float(&buf, alt);
le_write32(ptr, i[0] << 24 | i[3] << 16 | i[2] << 8 | i[1]);
}
static void
gnav_trl_read(void)
{
- route_head *trk = NULL;
+ route_head* trk = NULL;
while (! gbfeof(fin)) {
gnav_trl_t rec;
- waypoint *wpt;
+ waypoint* wpt;
if (gbfread(&rec, sizeof(rec), 1, fin) != 1) {
fatal(MYNAME ": Unexpected EOF (end of file)!\n");
}
static void
-gnav_trl_write_trkpt(const waypoint *wpt)
+gnav_trl_write_trkpt(const waypoint* wpt)
{
gnav_trl_t rec;
ff_type_file,
{
ff_cap_none /* waypoints */,
- ff_cap_read | ff_cap_write /* tracks */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */,
ff_cap_none /* routes */
},
gnav_trl_rd_init,
#include "defs.h"
#include "xmlgeneric.h"
-static char *encoded_points = NULL;
-static char *encoded_levels = NULL;
-static char *script = NULL;
-static route_head **routehead;
-static int *routecount;
+static char* encoded_points = NULL;
+static char* encoded_levels = NULL;
+static char* script = NULL;
+static route_head** routehead;
+static int* routecount;
static short_handle desc_handle;
static int serial = 0;
#if ! HAVE_LIBEXPAT
static void
-google_rd_init(const char *fname)
+google_rd_init(const char* fname)
{
fatal(MYNAME ": This build excluded Google Maps support because expat was not installed.\n");
}
{ goog_td_b, cb_cdata, "/div/div/table/tr/td/b" },
{ goog_td_e, cb_end, "/div/table/tr/td" },
{ goog_td_e, cb_end, "/div/div/table/tr/td" },
- { NULL, 0, NULL }
+ { NULL, (xg_cb_type)0, NULL }
};
-void goog_script(const char *args, const char **unused)
+void goog_script(const char* args, const char** unused)
{
if (args) {
if (script) {
}
}
-void goog_points(const char *args, const char **unused)
+void goog_points(const char* args, const char** unused)
{
if (args) {
if (encoded_points) {
}
}
-void goog_levels(const char *args, const char **unused)
+void goog_levels(const char* args, const char** unused)
{
if (args) {
if (encoded_levels) {
}
static char goog_segname[7];
-static char *goog_realname = NULL;
+static char* goog_realname = NULL;
static int goog_segroute = 0;
/*
* The segments contain an index into the points array. We use that
* index to find the waypoint and insert a better name for it.
*/
-void goog_segment_s(const char *args, const char **attrv)
+void goog_segment_s(const char* args, const char** attrv)
{
- const char **avp = &attrv[0];
+ const char** avp = &attrv[0];
while (*avp) {
if (0 == strcmp(avp[0], "pointIndex")) {
snprintf(goog_segname, sizeof(goog_segname), "\\%5.5x", atoi(avp[1]));
}
-void goog_segment(const char *args, const char **unused)
+void goog_segment(const char* args, const char** unused)
{
- waypoint *wpt_tmp;
+ waypoint* wpt_tmp;
wpt_tmp = route_find_waypt_by_name(routehead[goog_segroute], goog_segname);
if (wpt_tmp) {
}
}
-void goog_td_s(const char *args, const char **attrv)
+void goog_td_s(const char* args, const char** attrv)
{
- const char **avp = &attrv[0];
+ const char** avp = &attrv[0];
int isdesc = 0;
int isseg = 0;
while (*avp) {
}
}
-void goog_td_b(const char *args, const char **attrv)
+void goog_td_b(const char* args, const char** attrv)
{
if (goog_segname[0] == '\\' && !strchr(args, '\xa0')) {
if (goog_realname) {
xfree(goog_realname);
goog_realname = NULL;
}
- goog_realname = xmalloc(strlen(args)+1);
+ goog_realname = (char*) xmalloc(strlen(args)+1);
strcpy(goog_realname, args);
}
}
-void goog_td_e(const char *args, const char **attrv)
+void goog_td_e(const char* args, const char** attrv)
{
if (goog_segname[0] == '\\' && goog_realname) {
goog_segment(goog_realname, attrv);
}
}
-static long decode_goog64(char **str)
+static long decode_goog64(char** str)
{
long result = 0;
unsigned char c = 0;
return result/2;
}
-void goog_poly_e(const char *args, const char **unused)
+void goog_poly_e(const char* args, const char** unused)
{
long lat = 0;
long lon = 0;
long level = 0;
long level1 = -9999;
long level2 = -9999;
- char *str = encoded_points;
- char *lstr = encoded_levels;
+ char* str = encoded_points;
+ char* lstr = encoded_levels;
routehead[goog_segroute] = route_head_alloc();
route_add_head(routehead[goog_segroute]);
}
{
- waypoint *wpt_tmp = waypt_new();
+ waypoint* wpt_tmp = waypt_new();
wpt_tmp->latitude = lat / 100000.0;
wpt_tmp->longitude = lon / 100000.0;
wpt_tmp->route_priority=level;
- wpt_tmp->shortname = (char *) xmalloc(7);
+ wpt_tmp->shortname = (char*) xmalloc(7);
sprintf(wpt_tmp->shortname, "\\%5.5x", serial++);
route_add_wpt(routehead[goog_segroute], wpt_tmp);
}
}
static void
-google_rd_init(const char *fname)
+google_rd_init(const char* fname)
{
desc_handle = mkshort_new_handle();
setshort_length(desc_handle, 12);
static void
google_read(void)
{
- routehead = (route_head **)xmalloc(sizeof(route_head *));
- routecount = (int *)xmalloc(sizeof(int));
+ routehead = (route_head**)xmalloc(sizeof(route_head*));
+ routecount = (int*)xmalloc(sizeof(int));
goog_segroute = 0;
xml_read();
xfree(routehead);
encoded_levels = NULL;
}
if (script) {
- char *xml = strchr(script, '\'');
- char *dict = strstr(script, "({");
+ char* xml = strchr(script, '\'');
+ char* dict = strstr(script, "({");
- char *end = NULL;
+ char* end = NULL;
if (xml && (!dict || (xml < dict))) {
- routehead = (route_head **)xmalloc(sizeof(route_head *));
- routecount = (int *)xmalloc(sizeof(int));
+ routehead = (route_head**)xmalloc(sizeof(route_head*));
+ routecount = (int*)xmalloc(sizeof(int));
goog_segroute = 0;
xml++;
end = strchr(xml+1, '\'');
int ofs = 9;
int panelofs = 8;
int count = 0;
- char *tmp = NULL;
- char *start = NULL;
+ char* tmp = NULL;
+ char* start = NULL;
- char *panel = strstr(dict, "panel: '");
+ char* panel = strstr(dict, "panel: '");
encoded_points = strstr(dict, "points: '");
encoded_levels = strstr(dict, "levels: '");
if (!encoded_points) {
tmp = panel;
while (tmp) {
if (qc == '"') {
- char *tmp1 = strstr(tmp, "\"points\":\"");
+ char* tmp1 = strstr(tmp, "\"points\":\"");
if (!tmp1) {
tmp1 = strstr(tmp, "points:\"");
}
tmp++;
}
}
- routehead = (route_head **)xmalloc(sizeof(route_head *)*count);
- routecount = (int *)xmalloc(sizeof(int)*count);
+ routehead = (route_head**)xmalloc(sizeof(route_head*)*count);
+ routecount = (int*)xmalloc(sizeof(int)*count);
goog_segroute = 0;
do {
}
}
if (end) {
- char *to = panel;
- char *from = panel;
+ char* to = panel;
+ char* from = panel;
while (*from) {
if (!strncmp(from, "\\\"", 2)) {
*to++ = '"';
#if 0
{
- FILE *foo = fopen("foo.xml", "w");
+ FILE* foo = fopen("foo.xml", "w");
fprintf(foo, "<!DOCTYPE foo [%s]>\n", xhtml_entities);
fwrite(panel, sizeof(char), strlen(panel), foo);
fclose(foo);
#include "grtcirc.h"
#define MYNAME "gopal"
-static gbfile *fin, *fout;
+static gbfile* fin, *fout;
static struct tm tm,filenamedate, trackdate;
time_t tx;
char tmp[64];
char routename[64];
-static char *optdate=NULL;
-static char *optmaxspeed=NULL;
-static char *optminspeed=NULL;
-static char *optclean= NULL;
+static char* optdate=NULL;
+static char* optmaxspeed=NULL;
+static char* optminspeed=NULL;
+static char* optclean= NULL;
static double minspeed,maxspeed;
static struct tm opt_tm; /* converted "date" parameter */
static
#define CHECK_BOOL(a) if (a && (*a == '0')) a = NULL
-int gopal_check_line(char *line)
+int gopal_check_line(char* line)
{
- char *c = line;
+ char* c = line;
int i = 0;
while ((c = strchr(c, ','))) {
c++;
*******************************************************************************/
static void
-gopal_rd_init(const char *fname)
+gopal_rd_init(const char* fname)
{
char buff[32];
- char *ck;
- char *filename;
+ char* ck;
+ char* filename;
CHECK_BOOL(optclean);
if (optminspeed) {
minspeed=atof(optminspeed);
if (optdate) {
memset(&opt_tm, 0, sizeof(opt_tm));
- ck = (char *)strptime(optdate, "%Y%m%d", &opt_tm);
+ ck = (char*)strptime(optdate, "%Y%m%d", &opt_tm);
if ((ck == NULL) || (*ck != '\0') || (strlen(optdate) != 8)) {
fatal(MYNAME ": Invalid date \"%s\"!\n", optdate);
} else if (opt_tm.tm_year < 70) {
strncpy(&buff[0],&filename[2],8);
}
// in buff we should now have something wich looks like a valid date starting with YYYYMMDD
- ck = (char *)strptime(buff, "%Y%m%d", &filenamedate);
+ ck = (char*)strptime(buff, "%Y%m%d", &filenamedate);
// if (((ck == NULL) || (*ck != '\0') )&&!(optdate))
// fatal(MYNAME ": Invalid date in filename \"%s\", try to set manually using \"date\" switch!\n", buff);
// /* else */ if (filenamedate.tm_year < 70)
gopal_read(void)
{
- char *buff;
- char *str, *c;
+ char* buff;
+ char* str, *c;
int column;
long line;
double hmsd,speed;
int fix, hms;
- route_head *route;
- waypoint *wpt, *lastwpt=NULL;
+ route_head* route;
+ waypoint* wpt, *lastwpt=NULL;
double long_old,lat_old;
char tbuffer[64];
struct tm tm2;
}
static void
-gopal_route_hdr(const route_head *route)
+gopal_route_hdr(const route_head* route)
{
}
static void
-gopal_route_tlr(const route_head *rte)
+gopal_route_tlr(const route_head* rte)
{
}
static void
-gopal_write_waypt(const waypoint *wpt)
+gopal_write_waypt(const waypoint* wpt)
{
char tbuffer[64];
unsigned long timestamp;
static void
-gopal_wr_init(const char *fname)
+gopal_wr_init(const char* fname)
{
fout = gbfopen(fname, "w", MYNAME);
}
ff_type_file,
{
ff_cap_none /* waypoints */,
- ff_cap_read | ff_cap_write /* tracks */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */,
ff_cap_none /* routes */
},
gopal_rd_init,
};
-static pdbfile *file_in, *file_out;
-static const char *out_fname;
+static pdbfile* file_in, *file_out;
+static const char* out_fname;
static int ct = 0;
-static char *dbname = NULL;
+static char* dbname = NULL;
static
arglist_t my_args[] = {
};
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
file_in = pdb_open(fname, MYNAME);
}
}
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
file_out = pdb_create(fname, MYNAME);
out_fname = fname;
static void
data_read(void)
{
- struct record *rec;
- pdbrec_t *pdb_rec;
- route_head *track_head = NULL;
+ struct record* rec;
+ pdbrec_t* pdb_rec;
+ route_head* track_head = NULL;
if (file_in->creator != MYCREATOR) {
fatal(MYNAME ": Not a %s file.\n", MYNAME);
}
for (pdb_rec = file_in->rec_list; pdb_rec; pdb_rec=pdb_rec->next) {
- waypoint *wpt_tmp;
- Custom_Trk_Point_Type *tp_cust;
- Compact_Trk_Point_Type *tp_comp;
+ waypoint* wpt_tmp;
+ Custom_Trk_Point_Type* tp_cust;
+ Compact_Trk_Point_Type* tp_comp;
int lat;
int lon;
int sz;
int trk_num = 0;
int trk_seg_num = 1;
char trk_seg_num_buf[10];
- char *trk_name = "";
+ char* trk_name = "";
wpt_tmp = waypt_new();
- rec = (struct record *) pdb_rec->data;
+ rec = (struct record*) pdb_rec->data;
switch (rec->header.type) {
/*
* G103Type
*/
switch (rec->wpt.CustTrkHdr.type) {
case 102:
- tp_cust = (Custom_Trk_Point_Type *)((char *) pdb_rec->data + sizeof(rec->header) + sizeof(rec->wpt.CustTrkHdr));
+ tp_cust = (Custom_Trk_Point_Type*)((char*) pdb_rec->data + sizeof(rec->header) + sizeof(rec->wpt.CustTrkHdr));
while (sz--) {
if ((int)(tp_cust->new_trk) == 1 || trk_seg_num == 1) {
/*
}
break;
case 104:
- tp_comp = (Compact_Trk_Point_Type *)((char *) pdb_rec->data + sizeof(rec->header) + sizeof(rec->wpt.CustTrkHdr));
+ tp_comp = (Compact_Trk_Point_Type*)((char*) pdb_rec->data + sizeof(rec->header) + sizeof(rec->wpt.CustTrkHdr));
while (sz--) {
if ((int)(tp_comp->new_trk) == 1 || trk_seg_num == 1) {
/*
struct hdr {
- char *wpt_name;
- waypoint *wpt;
+ char* wpt_name;
+ waypoint* wpt;
};
static void
-my_write_wpt(const waypoint *wpt)
+my_write_wpt(const waypoint* wpt)
{
- struct record *rec;
- char *vdata;
+ struct record* rec;
+ char* vdata;
int lat, lon;
rec = xcalloc(sizeof *rec, 1);
- vdata = (char *)rec + sizeof(*rec);
+ vdata = (char*)rec + sizeof(*rec);
rec->header.type = 4;
rec->header.size = 5;
le_write32(&rec->wpt.d103.lat, lat);
le_write32(&rec->wpt.d103.lon, lon);
- pdb_write_rec(file_out, 0, ct, ct+1, rec, (char *)vdata - (char *)rec);
+ pdb_write_rec(file_out, 0, ct, ct+1, rec, (char*)vdata - (char*)rec);
ct++;
xfree(rec);
}
pdb_32 en_latitude; /* similarly */
};
-static pdbfile *file_in, *file_out;
-static const char *out_fname;
-static char *dbname = NULL;
+static pdbfile* file_in, *file_out;
+static const char* out_fname;
+static char* dbname = NULL;
static int ct;
static
};
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
file_in = pdb_open(fname, MYNAME);
}
}
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
file_out = pdb_create(fname, MYNAME);
out_fname = fname;
static void
data_read(void)
{
- struct record *rec;
- pdbrec_t *pdb_rec;
+ struct record* rec;
+ pdbrec_t* pdb_rec;
if ((file_in->creator != MYCREATOR)) {
fatal(MYNAME ": Not a gpspilot file.\n");
}
for (pdb_rec = file_in->rec_list; pdb_rec; pdb_rec = pdb_rec->next) {
- waypoint *wpt_tmp;
- char *vdata;
+ waypoint* wpt_tmp;
+ char* vdata;
wpt_tmp = waypt_new();
- rec = (struct record *) pdb_rec->data;
+ rec = (struct record*) pdb_rec->data;
wpt_tmp->longitude = be_read32(&rec->longitude) / 3.6e6;
wpt_tmp->latitude = be_read32(&rec->latitude) / 3.6e6;
wpt_tmp->altitude =
be_read16(&rec->elevation);
- vdata = (char *) pdb_rec->data + sizeof(*rec);
+ vdata = (char*) pdb_rec->data + sizeof(*rec);
/*
* skip runway records if an airport.
static void
-gpspilot_writewpt(const waypoint *wpt)
+gpspilot_writewpt(const waypoint* wpt)
{
- struct record *rec;
- char *vdata;
+ struct record* rec;
+ char* vdata;
rec = (struct record*) xcalloc(sizeof(*rec)+206,1);
be_write16(&rec->elevation, si_round(wpt->altitude));
be_write16(&rec->magvar, 0);
- vdata = (char *)rec + sizeof(*rec);
+ vdata = (char*)rec + sizeof(*rec);
if (wpt->description) {
strncpy(vdata, wpt->description, 36);
vdata[35] = '\0';
}
vdata += strlen(vdata) + 1;
- pdb_write_rec(file_out, 0, 2, ct++, (void *)rec, (char *)vdata - (char *)rec);
+ pdb_write_rec(file_out, 0, 2, ct++, (void*)rec, (char*)vdata - (char*)rec);
xfree(rec);
}
#define MYNAME "gpssim"
-static gbfile *fout;
-static char *wayptspd;
-static char *splitfiles_opt;
+static gbfile* fout;
+static char* wayptspd;
+static char* splitfiles_opt;
static int splitfiles;
-static char *fnamestr;
+static char* fnamestr;
static int trk_count;
static int doing_tracks;
*/
static void
-gpssim_wr_init(const char *fname)
+gpssim_wr_init(const char* fname)
{
fnamestr = xstrdup(fname);
trk_count = 0;
*/
static void
-gpssim_write_sentence(const char *const s)
+gpssim_write_sentence(const char* const s)
{
gbfprintf(fout, "$%s*%02X\r\n", s, nmea_cksum(s));
}
}
static void
-gpssim_write_pt(const waypoint *wpt)
+gpssim_write_pt(const waypoint* wpt)
{
char obuf[1024];
double lat, lon;
if (wpt->creation_time) {
char tbuf[20];
int hms, ymd;
- struct tm *tm;
+ struct tm* tm;
tm = gmtime(&wpt->creation_time);
hms = tm->tm_hour * 10000 + tm->tm_min * 100 + tm->tm_sec;
}
static void
-gpssim_trk_hdr(const route_head *rh)
+gpssim_trk_hdr(const route_head* rh)
{
if (splitfiles) {
char c[1024];
- char *ofname = xstrdup(fnamestr);
+ char* ofname = xstrdup(fnamestr);
if (fout) {
fatal(MYNAME ": output file already open.\n");
}
static void
-gpssim_trk_ftr(const route_head *rh)
+gpssim_trk_ftr(const route_head* rh)
{
if (splitfiles) {
gbfclose(fout);
{
if (waypt_count()) {
if (splitfiles) {
- char *ofname = xstrdup(fnamestr);
+ char* ofname = xstrdup(fnamestr);
ofname = xstrappend(ofname, "-waypoints.gpssim");
fout = gbfopen(ofname, "wb", MYNAME);
xfree(ofname);
#include "defs.h"
#include "magellan.h"
-static gbfile *file_in, *file_out;
+static gbfile* file_in, *file_out;
static short_handle mkshort_handle;
#define MYNAME "GPSUTIL"
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
file_in = gbfopen(fname, "rb", MYNAME);
}
}
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
file_out = gbfopen(fname, "w", MYNAME);
mkshort_handle = mkshort_new_handle();
static void
data_read(void)
{
- char *ibuf;
+ char* ibuf;
char desc[31];
double lat,lon;
char latdir, londir;
long alt;
char alttype;
char icon[3];
- waypoint *wpt_tmp;
+ waypoint* wpt_tmp;
int line = 0;
/*
* Make sure that all waypoints in single read have same
while ((ibuf = gbfgetstr(file_in))) {
int n, len;
- char *sn;
+ char* sn;
if ((line++ == 0) && file_in->unicode) {
cet_convert_init(CET_CHARSET_UTF8, 1);
}
static void
-gpsutil_disp(const waypoint *wpt)
+gpsutil_disp(const waypoint* wpt)
{
double lon,lat;
- const char *icon_token;
- char *tdesc = xstrdup(wpt->description);
+ const char* icon_token;
+ char* tdesc = xstrdup(wpt->description);
icon_token = mag_find_token_from_descr(wpt->icon_descr);
static XML_Parser psr;
#endif
-static xml_tag *cur_tag;
+static xml_tag* cur_tag;
static vmem_t cdatastr;
-static char *opt_logpoint = NULL;
-static char *opt_humminbirdext = NULL;
-static char *opt_garminext = NULL;
+static char* opt_logpoint = NULL;
+static char* opt_humminbirdext = NULL;
+static char* opt_garminext = NULL;
static int logpoint_ct = 0;
-static const char *gpx_version;
-static char *gpx_wversion;
+static const char* gpx_version;
+static char* gpx_wversion;
static int gpx_wversion_num;
-static const char *gpx_creator;
-static char *xsi_schema_loc = NULL;
+static const char* gpx_creator;
+static char* xsi_schema_loc = NULL;
-static char *gpx_email = NULL;
-static char *gpx_author = NULL;
+static char* gpx_email = NULL;
+static char* gpx_author = NULL;
static vmem_t current_tag;
-static waypoint *wpt_tmp;
+static waypoint* wpt_tmp;
static int cache_descr_is_html;
-static gbfile *fd;
-static const char *input_fname;
-static gbfile *ofd;
+static gbfile* fd;
+static const char* input_fname;
+static gbfile* ofd;
static short_handle mkshort_handle;
-static const char *link_url;
-static char *link_text;
+static const char* link_url;
+static char* link_text;
-static const char *input_string = NULL;
+static const char* input_string = NULL;
static int input_string_len = 0;
static time_t file_time;
-static char *snlen = NULL;
-static char *suppresswhite = NULL;
-static char *urlbase = NULL;
-static route_head *trk_head;
-static route_head *rte_head;
-static const route_head *current_trk_head; // Output.
+static char* snlen = NULL;
+static char* suppresswhite = NULL;
+static char* urlbase = NULL;
+static route_head* trk_head;
+static route_head* rte_head;
+static const route_head* current_trk_head; // Output.
/* used for bounds calculation on output */
static bounds all_bounds;
static int next_trkpt_is_new_seg;
-static format_specific_data **fs_ptr;
+static format_specific_data** fs_ptr;
#define MYNAME "GPX"
#define MY_CBUF_SZ 4096
typedef struct {
struct queue queue;
- char *tagdata;
+ char* tagdata;
} gpx_global_entry;
/*
gpx_global_entry urlname;
gpx_global_entry keywords;
/* time and bounds aren't here; they're recomputed. */
-} *gpx_global ;
+}* gpx_global ;
static void
-gpx_add_to_global(gpx_global_entry *ge, char *cdata)
+gpx_add_to_global(gpx_global_entry* ge, char* cdata)
{
- queue *elem, *tmp;
- gpx_global_entry * gep;
+ queue* elem, *tmp;
+ gpx_global_entry* gep;
QUEUE_FOR_EACH(&ge->queue, elem, tmp) {
gep = BASE_STRUCT(elem, gpx_global_entry, queue);
}
static void
-gpx_rm_from_global(gpx_global_entry *ge)
+gpx_rm_from_global(gpx_global_entry* ge)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&ge->queue, elem, tmp) {
- gpx_global_entry *g = (gpx_global_entry *) dequeue(elem);
+ gpx_global_entry* g = (gpx_global_entry*) dequeue(elem);
xfree(g->tagdata);
xfree(g);
}
}
static void
-gpx_write_gdata(gpx_global_entry *ge, const char *tag)
+gpx_write_gdata(gpx_global_entry* ge, const char* tag)
{
- queue *elem, *tmp;
- gpx_global_entry * gep;
+ queue* elem, *tmp;
+ gpx_global_entry* gep;
if (!gpx_global || QUEUE_EMPTY(&ge->queue)) {
return;
typedef struct tag_mapping {
tag_type tag_type_; /* enum from above for this tag */
int tag_passthrough; /* true if we don't generate this */
- const char *tag_name; /* xpath-ish tag name */
+ const char* tag_name; /* xpath-ish tag name */
unsigned long crc; /* Crc32 of tag_name */
} tag_mapping;
};
static tag_type
-get_tag(const char *t, int *passthrough)
+get_tag(const char* t, int* passthrough)
{
- tag_mapping *tm;
+ tag_mapping* tm;
unsigned long tcrc = get_crc32_s(t);
for (tm = tag_path_map; tm->tag_type_ != 0; tm++) {
static void
prescan_tags(void)
{
- tag_mapping *tm;
+ tag_mapping* tm;
for (tm = tag_path_map; tm->tag_type_ != 0; tm++) {
tm->crc = get_crc32_s(tm->tag_name);
}
}
static void
-tag_gpx(const char **attrv)
+tag_gpx(const char** attrv)
{
- const char **avp;
+ const char** avp;
for (avp = &attrv[0]; *avp; avp += 2) {
if (strcmp(avp[0], "version") == 0) {
gpx_version = avp[1];
}
static void
-tag_wpt(const char **attrv)
+tag_wpt(const char** attrv)
{
- const char **avp = &attrv[0];
+ const char** avp = &attrv[0];
wpt_tmp = waypt_new();
}
static void
-tag_cache_desc(const char ** attrv)
+tag_cache_desc(const char** attrv)
{
- const char **avp;
+ const char** avp;
cache_descr_is_html = 0;
for (avp = &attrv[0]; *avp; avp+=2) {
}
static void
-tag_gs_cache(const char **attrv)
+tag_gs_cache(const char** attrv)
{
- const char **avp;
- geocache_data *gc_data = waypt_alloc_gc_data(wpt_tmp);
+ const char** avp;
+ geocache_data* gc_data = waypt_alloc_gc_data(wpt_tmp);
for (avp = &attrv[0]; *avp; avp+=2) {
if (strcmp(avp[0], "id") == 0) {
}
static void
-start_something_else(const char *el, const char **attrv)
+start_something_else(const char* el, const char** attrv)
{
- const char **avp = attrv;
- char **avcp = NULL;
+ const char** avp = attrv;
+ char** avcp = NULL;
int attr_count = 0;
- xml_tag *new_tag;
- fs_xml *fs_gpx;
+ xml_tag* new_tag;
+ fs_xml* fs_gpx;
if (!fs_ptr) {
return;
}
- new_tag = (xml_tag *)xcalloc(sizeof(xml_tag),1);
+ new_tag = (xml_tag*)xcalloc(sizeof(xml_tag),1);
new_tag->tagname = xstrdup(el);
/* count attributes */
/* copy attributes */
avp = attrv;
- new_tag->attributes = (char **)xcalloc(sizeof(char *),attr_count+1);
+ new_tag->attributes = (char**)xcalloc(sizeof(char*),attr_count+1);
avcp = new_tag->attributes;
while (*avp) {
*avcp = xstrdup(*avp);
new_tag->parent = cur_tag;
}
} else {
- fs_gpx = (fs_xml *)fs_chain_find(*fs_ptr, FS_GPX);
+ fs_gpx = (fs_xml*)fs_chain_find(*fs_ptr, FS_GPX);
if (fs_gpx && fs_gpx->tag) {
cur_tag = fs_gpx->tag;
} else {
fs_gpx = fs_xml_alloc(FS_GPX);
fs_gpx->tag = new_tag;
- fs_chain_add(fs_ptr, (format_specific_data *)fs_gpx);
+ fs_chain_add(fs_ptr, (format_specific_data*)fs_gpx);
new_tag->parent = NULL;
}
}
}
static void
-tag_log_wpt(const char **attrv)
+tag_log_wpt(const char** attrv)
{
- waypoint * lwp_tmp;
- const char **avp = &attrv[0];
+ waypoint* lwp_tmp;
+ const char** avp = &attrv[0];
/* create a new waypoint */
lwp_tmp = waypt_new();
if ((wpt_tmp->shortname) && (strlen(wpt_tmp->shortname) > 2)) {
/* copy of the shortname */
- lwp_tmp->shortname = (char *) xcalloc(7, 1);
+ lwp_tmp->shortname = (char*) xcalloc(7, 1);
sprintf(lwp_tmp->shortname, "%-4.4s%02d",
&wpt_tmp->shortname[2], logpoint_ct++);
}
static void
-gpx_start(void *data, const XML_Char *xml_el, const XML_Char **xml_attr)
+gpx_start(void* data, const XML_Char* xml_el, const XML_Char** xml_attr)
{
- char *e;
- char *ep;
+ char* e;
+ char* ep;
int passthrough;
int tag;
- const char *el = xml_convert_to_char_string(xml_el);
- const char **attr = xml_convert_attrs_to_char_string(xml_attr);
+ const char* el = xml_convert_to_char_string(xml_el);
+ const char** attr = xml_convert_attrs_to_char_string(xml_attr);
vmem_realloc(¤t_tag, strlen(current_tag.mem) + 2 + strlen(el));
e = current_tag.mem;
/*
* Reset end-of-string without actually emptying/reallocing cdatastr.
*/
- *(char *) cdatastr.mem = 0;
+ *(char*) cdatastr.mem = 0;
tag = get_tag(current_tag.mem, &passthrough);
switch (tag) {
struct
gs_type_mapping {
geocache_type type;
- const char *name;
+ const char* name;
} gs_type_map[] = {
{ gt_traditional, "Traditional Cache" },
{ gt_traditional, "Traditional" }, /* opencaching.de */
struct
gs_container_mapping {
geocache_container type;
- const char *name;
+ const char* name;
} gs_container_map[] = {
{ gc_other, "Unknown" },
{ gc_other, "Other" }, /* Synonym on read. */
};
geocache_type
-gs_mktype(const char *t)
+gs_mktype(const char* t)
{
int i;
int sz = sizeof(gs_type_map) / sizeof(gs_type_map[0]);
return gt_unknown;
}
-const char *
+const char*
gs_get_cachetype(geocache_type t)
{
int i;
}
geocache_container
-gs_mkcont(const char *t)
+gs_mkcont(const char* t)
{
int i;
int sz = sizeof(gs_container_map) / sizeof(gs_container_map[0]);
return gc_unknown;
}
-const char *
+const char*
gs_get_container(geocache_container t)
{
int i;
}
time_t
-xml_parse_time(const char *cdatastr, int *microsecs)
+xml_parse_time(const char* cdatastr, int* microsecs)
{
int off_hr = 0;
int off_min = 0;
int off_sign = 1;
- char *offsetstr = NULL;
- char *pointstr = NULL;
+ char* offsetstr = NULL;
+ char* pointstr = NULL;
struct tm tm;
time_t rv = 0;
- char *timestr = xstrdup(cdatastr);
+ char* timestr = xstrdup(cdatastr);
memset(&tm, 0, sizeof(tm));
}
static void
-gpx_end(void *data, const XML_Char *xml_el)
+gpx_end(void* data, const XML_Char* xml_el)
{
- const char *el = xml_convert_to_char_string(xml_el);
- char *s = strrchr(current_tag.mem, '/');
+ const char* el = xml_convert_to_char_string(xml_el);
+ char* s = strrchr(current_tag.mem, '/');
float x;
- char *cdatastrp = cdatastr.mem;
+ char* cdatastrp = cdatastr.mem;
int passthrough;
static time_t gc_log_date;
tag_type tag;
case tt_cache_desc_long:
rtrim(cdatastrp);
if (cdatastrp[0]) {
- geocache_data *gc_data = waypt_alloc_gc_data(wpt_tmp);
+ geocache_data* gc_data = waypt_alloc_gc_data(wpt_tmp);
gc_data->desc_long.is_html = cache_descr_is_html;
gc_data->desc_long.utfstring = xstrdup(cdatastrp);
}
case tt_cache_desc_short:
rtrim(cdatastrp);
if (cdatastrp[0]) {
- geocache_data *gc_data = waypt_alloc_gc_data(wpt_tmp);
+ geocache_data* gc_data = waypt_alloc_gc_data(wpt_tmp);
gc_data->desc_short.is_html = cache_descr_is_html;
gc_data->desc_short.utfstring = xstrdup(cdatastrp);
}
//TODO: implement GPX 1.1 case tt_trk_trkseg_trkpt_link:
//TODO: implement GPX 1.1 case tt_rte_rtept_link:
{
- char *lt = link_text;
+ char* lt = link_text;
if (lt) {
lt = xstrdup(lrtrim(link_text));
}
#if ! HAVE_LIBEXPAT
static void
-gpx_rd_init(const char *fname)
+gpx_rd_init(const char* fname)
{
fatal(MYNAME ": This build excluded GPX support because expat was not installed.\n");
}
#else /* NO_EXPAT */
static void
-gpx_cdata(void *dta, const XML_Char *xml_el, int len)
+gpx_cdata(void* dta, const XML_Char* xml_el, int len)
{
- char *estr;
- int *cdatalen;
- char **cdata;
- xml_tag *tmp_tag;
+ char* estr;
+ int* cdatalen;
+ char** cdata;
+ xml_tag* tmp_tag;
size_t slen = strlen(cdatastr.mem);
- const char *s = xml_convert_to_char_string_n(xml_el, &len);
+ const char* s = xml_convert_to_char_string_n(xml_el, &len);
vmem_realloc(&cdatastr, 1 + len + slen);
- estr = ((char *) cdatastr.mem) + slen;
+ estr = ((char*) cdatastr.mem) + slen;
memcpy(estr, s, len);
estr[len] = 0;
}
static void
-gpx_rd_init(const char *fname)
+gpx_rd_init(const char* fname)
{
if (fname[0]) {
fd = gbfopen(fname, "r", MYNAME);
file_time = 0;
current_tag = vmem_alloc(1, 0);
- *((char *)current_tag.mem) = '\0';
+ *((char*)current_tag.mem) = '\0';
prescan_tags();
XML_SetUnknownEncodingHandler(psr, cet_lib_expat_UnknownEncodingHandler, NULL);
cdatastr = vmem_alloc(1, 0);
- *((char *)cdatastr.mem) = '\0';
+ *((char*)cdatastr.mem) = '\0';
if (!xsi_schema_loc) {
xsi_schema_loc = xstrdup(DEFAULT_XSI_SCHEMA_LOC);
#endif
static void
-gpx_wr_init(const char *fname)
+gpx_wr_init(const char* fname)
{
mkshort_handle = mkshort_new_handle();
#if HAVE_LIBEXPAT
int len;
int done = 0;
- char *buf = (char*) xmalloc(MY_CBUF_SZ);
+ char* buf = (char*) xmalloc(MY_CBUF_SZ);
int result = 0;
int extra;
* we find it, strip it, then read byte-at-a-time
* until we find a non-entity.
*/
- char *badchar;
- char *semi;
+ char* badchar;
+ char* semi;
int maxentlength = 8;
len = gbfread(buf, 1, MY_CBUF_SZ - maxentlength, fd);
done = gbfeof(fd) || !len;
badchar = strstr(buf, "&#x");
while (badchar) {
int val = 0;
- char *hexit = badchar+3;
+ char* hexit = badchar+3;
semi = strchr(badchar, ';');
if (semi) {
while (*hexit && *hexit != ';') {
}
static void
-fprint_tag_and_attrs(const char *prefix, const char *suffix, xml_tag *tag)
+fprint_tag_and_attrs(const char* prefix, const char* suffix, xml_tag* tag)
{
- char **pa;
+ char** pa;
gbfprintf(ofd, "%s%s", prefix, tag->tagname);
pa = tag->attributes;
if (pa) {
}
static void
-fprint_xml_chain(xml_tag *tag, const waypoint *wpt)
+fprint_xml_chain(xml_tag* tag, const waypoint* wpt)
{
- char *tmp_ent;
+ char* tmp_ent;
while (tag) {
if (!tag->cdata && !tag->child) {
fprint_tag_and_attrs("<", " />", tag);
}
}
-void free_gpx_extras(xml_tag *tag)
+void free_gpx_extras(xml_tag* tag)
{
- xml_tag *next = NULL;
- char **ap;
+ xml_tag* next = NULL;
+ char** ap;
while (tag) {
if (tag->cdata) {
* Handle the grossness of GPX 1.0 vs. 1.1 handling of linky links.
*/
static void
-write_gpx_url(const waypoint *waypointp)
+write_gpx_url(const waypoint* waypointp)
{
- char *tmp_ent;
+ char* tmp_ent;
if (waypointp->url == NULL) {
return;
}
if (gpx_wversion_num > 10) {
- url_link *tail;
- for (tail = (url_link *)&waypointp->url_next; tail; tail = tail->url_next) {
+ url_link* tail;
+ for (tail = (url_link*)&waypointp->url_next; tail; tail = tail->url_next) {
tmp_ent = xml_entitize(tail->url);
gbfprintf(ofd, " <link href=\"%s%s\">\n",
urlbase ? urlbase : "", tmp_ent);
* Order counts.
*/
static void
-gpx_write_common_acc(const waypoint *waypointp, const char *indent)
+gpx_write_common_acc(const waypoint* waypointp, const char* indent)
{
- const char *fix = NULL;
+ const char* fix = NULL;
switch (waypointp->fix) {
case fix_2d:
static void
-gpx_write_common_position(const waypoint *waypointp, const char *indent)
+gpx_write_common_position(const waypoint* waypointp, const char* indent)
{
if (waypointp->altitude != unknown_alt) {
gbfprintf(ofd, "%s<ele>%f</ele>\n",
}
static void
-gpx_write_common_extensions(const waypoint *waypointp, const char *indent)
+gpx_write_common_extensions(const waypoint* waypointp, const char* indent)
{
if (((opt_humminbirdext || opt_garminext) && (waypointp->depth != 0 || waypointp->temperature != 0))
|| (opt_garminext && (waypointp->heartrate != 0 || waypointp->cadence != 0))) {
}
static void
-gpx_write_common_description(const waypoint *waypointp, const char *indent,
- const char *oname)
+gpx_write_common_description(const waypoint* waypointp, const char* indent,
+ const char* oname)
{
write_optional_xml_entity(ofd, indent, "name", oname);
write_optional_xml_entity(ofd, indent, "cmt", waypointp->description);
}
static void
-gpx_waypt_pr(const waypoint *waypointp)
+gpx_waypt_pr(const waypoint* waypointp)
{
- const char *oname;
- char *odesc;
- fs_xml *fs_gpx;
- garmin_fs_t *gmsd; /* gARmIN sPECIAL dATA */
+ const char* oname;
+ char* odesc;
+ fs_xml* fs_gpx;
+ garmin_fs_t* gmsd; /* gARmIN sPECIAL dATA */
/*
* Desparation time, try very hard to get a good shortname
gpx_write_common_description(waypointp, " ", oname);
gpx_write_common_acc(waypointp, " ");
- fs_gpx = (fs_xml *)fs_chain_find(waypointp->fs, FS_GPX);
+ fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX);
gmsd = GMSD_FIND(waypointp);
if (fs_gpx) {
if (! gmsd) {
}
static void
-gpx_track_hdr(const route_head *rte)
+gpx_track_hdr(const route_head* rte)
{
- fs_xml *fs_gpx;
+ fs_xml* fs_gpx;
current_trk_head = rte;
gbfprintf(ofd, "<trk>\n");
}
if (gpx_wversion_num > 10) {
- fs_gpx = (fs_xml *)fs_chain_find(rte->fs, FS_GPX);
+ fs_gpx = (fs_xml*)fs_chain_find(rte->fs, FS_GPX);
if (fs_gpx) {
fprint_xml_chain(fs_gpx->tag, NULL);
}
}
static void
-gpx_track_disp(const waypoint *waypointp)
+gpx_track_disp(const waypoint* waypointp)
{
- fs_xml *fs_gpx;
+ fs_xml* fs_gpx;
int first_in_trk;
first_in_trk = waypointp->Q.prev == ¤t_trk_head->waypoint_list;
NULL : waypointp->shortname);
gpx_write_common_acc(waypointp, " ");
- fs_gpx = (fs_xml *)fs_chain_find(waypointp->fs, FS_GPX);
+ fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX);
if (fs_gpx) {
fprint_xml_chain(fs_gpx->tag, waypointp);
}
}
static void
-gpx_track_tlr(const route_head *rte)
+gpx_track_tlr(const route_head* rte)
{
if (!QUEUE_EMPTY(¤t_trk_head->waypoint_list)) {
gbfprintf(ofd, "</trkseg>\n");
}
static void
-gpx_route_hdr(const route_head *rte)
+gpx_route_hdr(const route_head* rte)
{
- fs_xml *fs_gpx;
+ fs_xml* fs_gpx;
gbfprintf(ofd, "<rte>\n");
write_optional_xml_entity(ofd, " ", "name", rte->rte_name);
}
if (gpx_wversion_num > 10) {
- fs_gpx = (fs_xml *)fs_chain_find(rte->fs, FS_GPX);
+ fs_gpx = (fs_xml*)fs_chain_find(rte->fs, FS_GPX);
if (fs_gpx) {
fprint_xml_chain(fs_gpx->tag, NULL);
}
}
static void
-gpx_route_disp(const waypoint *waypointp)
+gpx_route_disp(const waypoint* waypointp)
{
- fs_xml *fs_gpx;
+ fs_xml* fs_gpx;
gbfprintf(ofd, " <rtept lat=\"" FLT_FMT_R "\" lon=\"" FLT_FMT_R "\">\n",
waypointp->latitude,
gpx_write_common_description(waypointp, " ", waypointp->shortname);
gpx_write_common_acc(waypointp, " ");
- fs_gpx = (fs_xml *)fs_chain_find(waypointp->fs, FS_GPX);
+ fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX);
if (fs_gpx) {
fprint_xml_chain(fs_gpx->tag, waypointp);
}
}
static void
-gpx_route_tlr(const route_head *rte)
+gpx_route_tlr(const route_head* rte)
{
gbfprintf(ofd, "</rte>\n");
}
}
static void
-gpx_waypt_bound_calc(const waypoint *waypointp)
+gpx_waypt_bound_calc(const waypoint* waypointp)
{
waypt_add_to_bounds(&all_bounds, waypointp);
}
int short_length;
if (opt_humminbirdext || opt_garminext) {
- gpx_wversion = (char *)"1.1";
+ gpx_wversion = (char*)"1.1";
}
gpx_wversion_num = strtod(gpx_wversion, NULL) * 10;
static void crossproduct(double x1, double y1, double z1,
double x2, double y2, double z2,
- double *xa, double *ya, double *za)
+ double* xa, double* ya, double* za)
{
*xa = y1*z2-y2*z1;
*ya = z1*x2-z2*x1;
void linepart(double lat1, double lon1,
double lat2, double lon2,
double frac,
- double *reslat, double *reslon)
+ double* reslat, double* reslon)
{
double x1,y1,z1;
void linepart(double lat1, double lon1,
double lat2, double lon2,
double frac,
- double *reslat, double *reslon);
+ double* reslat, double* reslon);
/* Degrees to radians */
#define DEG(x) ((x)*180.0/M_PI)
#include "defs.h"
#include "jeeps/gpsmath.h"
-static gbfile *file_in, *file_out;
+static gbfile* file_in, *file_out;
static int indatum;
static int wp_count;
static int ws_count;
static int ts_count;
static int rt_count;
static int im_count;
-static const route_head *rte_active;
+static const route_head* rte_active;
static int start_new;
#define MYNAME "GTM"
#if 0
/* not used */
static short int
-fread_bool(gbfile *fd)
+fread_bool(gbfile* fd)
{
char buf[2];
gbfread(buf, 2, 1, fd);
#define fread_single(a) gbfgetflt(a)
#define fread_double(a) gbfgetdbl(a)
-static char *
-fread_string(gbfile *fd)
+static char*
+fread_string(gbfile* fd)
{
- char *val;
+ char* val;
int len = fread_integer(fd);
if (len == 0) {
return NULL;
}
- val = (char *) xmalloc(len+1);
+ val = (char*) xmalloc(len+1);
gbfread(val, 1, len, fd);
while (len != 0 && val[len-1] == ' ') {
len--;
}
static void
-fread_string_discard(gbfile *fd)
+fread_string_discard(gbfile* fd)
{
- char *temp = fread_string(fd);
+ char* temp = fread_string(fd);
if (temp != NULL) {
xfree(temp);
}
}
-static char *
-fread_fixedstring(gbfile *fd, int len)
+static char*
+fread_fixedstring(gbfile* fd, int len)
{
- char *val = (char *) xmalloc(len+1);
+ char* val = (char*) xmalloc(len+1);
gbfread(val, 1, len, fd);
while (len != 0 && val[len-1] == ' ') {
/* Write functions, according to specification. */
static void
-fwrite_null(gbfile *fd, int len)
+fwrite_null(gbfile* fd, int len)
{
char buf[1024];
#define fwrite_double(a,b) gbfputdbl((b), a)
static void
-fwrite_string(gbfile *fd, const char *str)
+fwrite_string(gbfile* fd, const char* str)
{
if (str && str[0]) {
int len = strlen(str);
}
void
-fwrite_fixedstring(gbfile *fd, const char *str, int fieldlen)
+fwrite_fixedstring(gbfile* fd, const char* str, int fieldlen)
{
int len = str ? strlen(str) : 0;
}
}
-static const char *icon_descr[] = {
+static const char* icon_descr[] = {
"", "Airport", "Ball Park", "Bank", "Bar", "Boat Ramp", "Campground", "Car",
"City (Large)", "City (Medium)", "City (Small)", "Dam", "Danger Area",
"Drinking Water", "Fishing Area", "Gas Station", "Glider Area", "Golf Course",
};
-void convert_datum(double *lat, double *lon)
+void convert_datum(double* lat, double* lon)
{
double amt;
if (indatum != -1 && indatum != 118) {
/* Callbacks */
static void
-gtm_rd_init(const char *fname)
+gtm_rd_init(const char* fname)
{
int version;
- char *name;
+ char* name;
file_in = gbfopen_le(fname, "rb", MYNAME);
version = fread_integer(file_in);
name = fread_fixedstring(file_in, 10);
gbfclose(file_in);
}
-static void count_route_waypts(const waypoint *wpt)
+static void count_route_waypts(const waypoint* wpt)
{
rt_count++;
}
-static void count_track_waypts(const waypoint *wpt)
+static void count_track_waypts(const waypoint* wpt)
{
tr_count++;
}
static void
-gtm_wr_init(const char *fname)
+gtm_wr_init(const char* fname)
{
rt_count = tr_count = 0;
track_disp_all(NULL, NULL, count_track_waypts);
static void
gtm_read(void)
{
- route_head *first_trk_head = NULL;
- route_head *trk_head = NULL;
- route_head *rte_head = NULL;
- waypoint *wpt;
+ route_head* first_trk_head = NULL;
+ route_head* trk_head = NULL;
+ route_head* rte_head = NULL;
+ waypoint* wpt;
int real_tr_count = 0;
- char *route_name;
+ char* route_name;
unsigned int icon;
int i;
for (i = 0; i != ts_count && i != real_tr_count; i++) {
trk_head->rte_name = fread_string(file_in);
fread_discard(file_in, 12);
- trk_head = (route_head *)QUEUE_NEXT(&trk_head->Q);
+ trk_head = (route_head*)QUEUE_NEXT(&trk_head->Q);
}
/* Routes */
}
}
-int icon_from_descr(const char *descr)
+int icon_from_descr(const char* descr)
{
if (descr) {
int i;
return 48;
}
-static void write_waypt(const waypoint *wpt)
+static void write_waypt(const waypoint* wpt)
{
fwrite_double(file_out, wpt->latitude);
fwrite_double(file_out, wpt->longitude);
fwrite_integer(file_out, 0);
}
-static void start_rte(const route_head *rte)
+static void start_rte(const route_head* rte)
{
rte_active = rte;
start_new = 1;
}
-static void write_trk_waypt(const waypoint *wpt)
+static void write_trk_waypt(const waypoint* wpt)
{
fwrite_double(file_out, wpt->latitude);
fwrite_double(file_out, wpt->longitude);
start_new = 0;
}
-static void write_trk_style(const route_head *trk)
+static void write_trk_style(const route_head* trk)
{
fwrite_string(file_out, trk->rte_name);
fwrite_byte(file_out, 1);
fwrite_integer(file_out, 0);
}
-static void write_rte_waypt(const waypoint *wpt)
+static void write_rte_waypt(const waypoint* wpt)
{
fwrite_double(file_out, wpt->latitude);
fwrite_double(file_out, wpt->longitude);
#include "defs.h"
#include "xmlgeneric.h"
-static gbfile *ofd;
+static gbfile* ofd;
static int lap_ct = 0;
static int lap_s = 0;
-static waypoint *wpt_tmp;
-static route_head *trk_head;
-static computed_trkdata *tdata;
+static waypoint* wpt_tmp;
+static route_head* trk_head;
+static computed_trkdata* tdata;
#define MYNAME "gtc"
static double gtc_end_lat;
static double gtc_end_long;
-static char *opt_sport, *opt_course;
+static char* opt_sport, *opt_course;
static
arglist_t gtc_args[] = {
#if ! HAVE_LIBEXPAT
static void
-gtc_rd_init(const char *fname)
+gtc_rd_init(const char* fname)
{
fatal(MYNAME ": this format does not support reading.\n");
}
{ gtc_wpt_lat, cb_cdata, "/Courses/Course/Lap/BeginPosition/LatitudeDegrees" },
{ gtc_wpt_long, cb_cdata, "/Courses/Course/Lap/BeginPosition/LongitudeDegrees" },
- { NULL, 0, NULL}
+ { NULL, (xg_cb_type)0, NULL}
};
-static const char *
+static const char*
gtc_tags_to_ignore[] = {
"TrainingCenterDatabase",
"CourseFolder",
};
static void
-gtc_rd_init(const char *fname)
+gtc_rd_init(const char* fname)
{
xml_init(fname, gtc_map, NULL);
xml_ignore_tags(gtc_tags_to_ignore);
#endif
static void
-gtc_wr_init(const char *fname)
+gtc_wr_init(const char* fname)
{
int i;
static int gtc_indent_level;
static void
-gtc_write_xml(int indent, const char *fmt, ...)
+gtc_write_xml(int indent, const char* fmt, ...)
{
va_list args;
}
static void
-gtc_waypt_pr(const waypoint *wpt)
+gtc_waypt_pr(const waypoint* wpt)
{
if (wpt->wpt_flags.is_split != 0) {
gtc_write_xml(1, "<Trackpoint split=\"yes\">\n");
}
static void
-gtc_act_hdr(const route_head *rte)
+gtc_act_hdr(const route_head* rte)
{
gtc_write_xml(1, "<Activity Sport=\"%s\">\n", gtc_sportlist[gtc_sport]);
if (gtc_least_time) {
}
static void
-gtc_act_ftr(const route_head *rte)
+gtc_act_ftr(const route_head* rte)
{
gtc_write_xml(-1, "</Track>\n");
gtc_write_xml(-1, "</Lap>\n");
}
static void
-gtc_crs_hdr(const route_head *rte)
+gtc_crs_hdr(const route_head* rte)
{
gtc_write_xml(1, "<Course>\n");
if (rte->rte_name) {
- char *name = xstrndup(rte->rte_name, GTC_MAX_NAME_LEN);
+ char* name = xstrndup(rte->rte_name, GTC_MAX_NAME_LEN);
gtc_write_xml(0, "<Name>%s</Name>\n", name);
xfree(name);
} else {
}
static void
-gtc_crs_ftr(const route_head *rte)
+gtc_crs_ftr(const route_head* rte)
{
gtc_write_xml(-1,"</Track>\n");
gtc_write_xml(-1, "</Course>\n");
}
static void
-gtc_lap_start(const route_head *rte)
+gtc_lap_start(const route_head* rte)
{
gtc_least_time = 0;
gtc_most_time = 0;
}
static void
-gtc_new_study_lap(const route_head *rte)
+gtc_new_study_lap(const route_head* rte)
{
track_recompute(rte, &tdata); /* called routine allocates space for tdata */
}
static void
-gtc_study_lap(const waypoint *wpt)
+gtc_study_lap(const waypoint* wpt)
{
if (wpt->creation_time && (gtc_least_time == 0)) {
gtc_least_time = wpt->creation_time;
}
void
-gtc_trk_s(const char *unused, const char **attrv)
+gtc_trk_s(const char* unused, const char** attrv)
{
trk_head = route_head_alloc();
track_add_head(trk_head);
}
void
-gtc_trk_ident(const char *args, const char **unused)
+gtc_trk_ident(const char* args, const char** unused)
{
trk_head->rte_name = xstrdup(args);
}
void
-gtc_trk_lap_s(const char *unused, const char **attrv)
+gtc_trk_lap_s(const char* unused, const char** attrv)
{
lap_ct++;
lap_s = 1;
}
void
-gtc_trk_lap_e(const char *unused, const char **attrv)
+gtc_trk_lap_e(const char* unused, const char** attrv)
{
lap_s = 0;
}
void
-gtc_trk_pnt_s(const char *unused, const char **attrv)
+gtc_trk_pnt_s(const char* unused, const char** attrv)
{
wpt_tmp = waypt_new();
}
void
-gtc_trk_pnt_e(const char *args, const char **unused)
+gtc_trk_pnt_e(const char* args, const char** unused)
{
if (wpt_tmp->longitude != 0. && wpt_tmp->latitude != 0.) {
if (lap_s) {
}
void
-gtc_trk_utc(const char *args, const char **unused)
+gtc_trk_utc(const char* args, const char** unused)
{
wpt_tmp->creation_time = xml_parse_time(args, NULL);
}
void
-gtc_trk_lat(const char *args, const char **unused)
+gtc_trk_lat(const char* args, const char** unused)
{
wpt_tmp->latitude = atof(args);
}
void
-gtc_trk_long(const char *args, const char **unused)
+gtc_trk_long(const char* args, const char** unused)
{
wpt_tmp->longitude = atof(args);
}
void
-gtc_trk_alt(const char *args, const char **unused)
+gtc_trk_alt(const char* args, const char** unused)
{
wpt_tmp->altitude = atof(args);
}
void
-gtc_trk_hr(const char *args, const char **unused)
+gtc_trk_hr(const char* args, const char** unused)
{
wpt_tmp->heartrate = atoi(args);
}
void
-gtc_trk_cad(const char *args, const char **unused)
+gtc_trk_cad(const char* args, const char** unused)
{
wpt_tmp->cadence = atoi(args);
}
void
-gtc_trk_pwr(const char *args, const char **unused)
+gtc_trk_pwr(const char* args, const char** unused)
{
wpt_tmp->power = atof(args);
}
void
-gtc_wpt_pnt_s(const char *unused, const char **attrv)
+gtc_wpt_pnt_s(const char* unused, const char** attrv)
{
wpt_tmp = waypt_new();
}
void
-gtc_wpt_pnt_e(const char *args, const char **unused)
+gtc_wpt_pnt_e(const char* args, const char** unused)
{
if (wpt_tmp->longitude != 0. && wpt_tmp->latitude != 0.) {
waypt_add(wpt_tmp);
}
void
-gtc_wpt_lat(const char *args, const char **unused)
+gtc_wpt_lat(const char* args, const char** unused)
{
wpt_tmp->latitude = atof(args);
}
void
-gtc_wpt_long(const char *args, const char **unused)
+gtc_wpt_long(const char* args, const char** unused)
{
wpt_tmp->longitude = atof(args);
}
ff_type_file,
{
ff_cap_read /* waypoints */,
- ff_cap_read | ff_cap_write /* tracks */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */,
ff_cap_none /* routes */
},
gtc_rd_init,
#define MYNAME "height"
#if FILTERS_ENABLED
-static char *addopt = NULL;
-static char *wgs84tomslopt = NULL;
+static char* addopt = NULL;
+static char* wgs84tomslopt = NULL;
static double addf;
static void
-correct_height(const waypoint *wpt)
+correct_height(const waypoint* wpt)
{
- waypoint *waypointp = (waypoint *) wpt;
+ waypoint* waypointp = (waypoint*) wpt;
if (addopt) {
waypointp->altitude += addf;
static void
-height_init(const char *args)
+height_init(const char* args)
{
- char *unit;
+ char* unit;
if (addopt) {
addf = strtod(addopt, &unit);
#include "defs.h"
#include "xmlgeneric.h"
-static gbfile *ofd;
-static waypoint *wpt_tmp;
-static route_head *trk_head;
+static gbfile* ofd;
+static waypoint* wpt_tmp;
+static route_head* trk_head;
#define MYNAME "hiketech"
{ ht_trk_lat, cb_cdata, "/hiketech/gpsdata/trk/pnt/lat" },
{ ht_trk_long, cb_cdata, "/hiketech/gpsdata/trk/pnt/long" },
{ ht_trk_alt, cb_cdata, "/hiketech/gpsdata/trk/pnt/alt" },
- { NULL, 0, NULL}
+ { NULL, (xg_cb_type)0, NULL}
};
static void
-hiketech_rd_init(const char *fname)
+hiketech_rd_init(const char* fname)
{
xml_init(fname, ht_map, NULL);
}
}
static void
-hiketech_wr_init(const char *fname)
+hiketech_wr_init(const char* fname)
{
ofd = gbfopen(fname, "w", MYNAME);
}
}
static void
-hiketech_trk_hdr(const route_head *rte)
+hiketech_trk_hdr(const route_head* rte)
{
gbfprintf(ofd, "<trk>\n");
write_optional_xml_entity(ofd, " ", "ident", rte->rte_name);
}
static void
-hiketech_trk_tlr(const route_head *rte)
+hiketech_trk_tlr(const route_head* rte)
{
gbfprintf(ofd, "</trk>\n");
}
static void
-hiketech_print_utc(time_t tm, const char *indent, const char *tag)
+hiketech_print_utc(time_t tm, const char* indent, const char* tag)
{
char tbuf[80];
strftime(tbuf, sizeof(tbuf), "%Y-%m-%d %I:%M:%S", gmtime(&tm));
}
static void
-hiketech_trkpt_pr(const waypoint *waypointp)
+hiketech_trkpt_pr(const waypoint* waypointp)
{
gbfprintf(ofd, " <pnt>\n");
if (waypointp->creation_time) {
}
static void
-hiketech_waypt_pr(const waypoint *wpt)
+hiketech_waypt_pr(const waypoint* wpt)
{
gbfprintf(ofd, "<wpt>\n");
write_xml_entity(ofd, "\t", "ident", wpt->shortname);
}
static
-void ht_wpt_s(const char *args, const char **unused)
+void ht_wpt_s(const char* args, const char** unused)
{
wpt_tmp = waypt_new();
}
static
-void ht_ident(const char *args, const char **unused)
+void ht_ident(const char* args, const char** unused)
{
wpt_tmp->shortname = xstrdup(args);
}
static
-void ht_sym(const char *args, const char **unused)
+void ht_sym(const char* args, const char** unused)
{
wpt_tmp->icon_descr = xstrdup(args);
wpt_tmp->wpt_flags.icon_descr_is_dynamic = 1;
}
static
-void ht_lat(const char *args, const char **unused)
+void ht_lat(const char* args, const char** unused)
{
wpt_tmp->latitude = atof(args);
}
static
-void ht_long(const char *args, const char **unused)
+void ht_long(const char* args, const char** unused)
{
wpt_tmp->longitude = atof(args);
}
static
-void ht_alt(const char *args, const char **unused)
+void ht_alt(const char* args, const char** unused)
{
wpt_tmp->altitude = atof(args);
}
static
-void ht_wpt_e(const char *args, const char **unused)
+void ht_wpt_e(const char* args, const char** unused)
{
waypt_add(wpt_tmp);
wpt_tmp = NULL;
}
static
-void ht_trk_s(const char *args, const char **unused)
+void ht_trk_s(const char* args, const char** unused)
{
trk_head = route_head_alloc();
track_add_head(trk_head);
}
static
-void ht_trk_e(const char *args, const char **unused)
+void ht_trk_e(const char* args, const char** unused)
{
}
static
-void ht_trk_ident(const char *args, const char **unused)
+void ht_trk_ident(const char* args, const char** unused)
{
trk_head->rte_name = xstrdup(args);
}
static
-void ht_trk_pnt_s(const char *args, const char **unused)
+void ht_trk_pnt_s(const char* args, const char** unused)
{
wpt_tmp = waypt_new();
}
static
-void ht_trk_pnt_e(const char *args, const char **unused)
+void ht_trk_pnt_e(const char* args, const char** unused)
{
track_add_wpt(trk_head, wpt_tmp);
}
static
-void ht_trk_utc(const char *args, const char **unused)
+void ht_trk_utc(const char* args, const char** unused)
{
struct tm tm;
time_t utc;
}
static
-void ht_trk_lat(const char *args, const char **unused)
+void ht_trk_lat(const char* args, const char** unused)
{
wpt_tmp->latitude = atof(args);
}
static
-void ht_trk_long(const char *args, const char **unused)
+void ht_trk_long(const char* args, const char** unused)
{
wpt_tmp->longitude = atof(args);
}
static
-void ht_trk_alt(const char *args, const char **unused)
+void ht_trk_alt(const char* args, const char** unused)
{
wpt_tmp->altitude = atof(args);
}
ff_vecs_t hiketech_vecs = {
ff_type_file,
- { ff_cap_read | ff_cap_write, ff_cap_read | ff_cap_write },
+ { (ff_cap)(ff_cap_read | ff_cap_write), (ff_cap)(ff_cap_read | ff_cap_write) },
hiketech_rd_init,
hiketech_wr_init,
hiketech_rd_deinit,
#include "holux.h"
-static gbfile *file_in, *file_out;
-static unsigned char *HxWFile;
+static gbfile* file_in, *file_out;
+static unsigned char* HxWFile;
static short_handle mkshort_handle;
#define MYNAME "Holux"
-static void rd_init(const char *fname)
+static void rd_init(const char* fname)
{
file_in = gbfopen_le(fname, "rb", MYNAME);
}
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
mkshort_handle = mkshort_new_handle();
- HxWFile = xcalloc(GM100_WPO_FILE_SIZE, 1);
+ HxWFile = (unsigned char*) xcalloc(GM100_WPO_FILE_SIZE, 1);
file_out = gbfopen_le(fname, "wb", MYNAME);
}
{
char name[9], desc[90];
double lat,lon;
- unsigned char *HxWpt;
- waypoint *wpt_tmp;
+ unsigned char* HxWpt;
+ waypoint* wpt_tmp;
int iCount;
int iDataRead;
int iWptNum;
int iWptIndex;
- WPT *pWptHxTmp;
+ WPT* pWptHxTmp;
struct tm tm;
- struct tm *ptm;
+ struct tm* ptm;
memset(&tm, 0, sizeof(tm));
- HxWpt = xcalloc(GM100_WPO_FILE_SIZE, 1);
+ HxWpt = (unsigned char*) xcalloc(GM100_WPO_FILE_SIZE, 1);
/* read the wpo file to the data-array */
iDataRead = gbfread(HxWpt, 1, GM100_WPO_FILE_SIZE, file_in);
fatal(MYNAME ": Error reading data from %s.\n", file_in->name);
}
- iWptNum = le_read16(&((WPTHDR *)HxWpt)->num);
+ iWptNum = le_read16(&((WPTHDR*)HxWpt)->num);
/* Get the waypoints */
for (iCount = 0; iCount < iWptNum ; iCount ++) {
wpt_tmp = waypt_new();
- iWptIndex = le_read16(&((WPTHDR *)HxWpt)->idx[iCount]);
- pWptHxTmp = (WPT *)&HxWpt[OFFS_WPT + (sizeof(WPT) * iWptIndex)];
+ iWptIndex = le_read16(&((WPTHDR*)HxWpt)->idx[iCount]);
+ pWptHxTmp = (WPT*)&HxWpt[OFFS_WPT + (sizeof(WPT) * iWptIndex)];
wpt_tmp->altitude = 0;
strncpy(name,pWptHxTmp->name,sizeof(pWptHxTmp->name));
-char *mknshort(char *stIn,unsigned int sLen)
+char* mknshort(char* stIn,unsigned int sLen)
{
#define MAX_STRINGLEN 255
static char strOut[MAX_STRINGLEN];
char strTmp[MAX_STRINGLEN];
- char *shortstr = NULL;
+ char* shortstr = NULL;
if (sLen > MAX_STRINGLEN) {
return (stIn);
-static void holux_disp(const waypoint *wpt)
+static void holux_disp(const waypoint* wpt)
{
double lon,lat;
- struct tm *tm;
+ struct tm* tm;
short sIndex;
- WPT *pWptHxTmp;
+ WPT* pWptHxTmp;
lon =(double)wpt->longitude * 36000;
lat =(double)wpt->latitude * -36000;
lat += (double)((int)lat/abs((int)lat)) * .5;
}
- sIndex = le_read16(&((WPTHDR *)HxWFile)->num);
- ((WPTHDR *)HxWFile)->idx[sIndex] = sIndex; /* set the waypoint index */
- le_write16(&((WPTHDR *)HxWFile)->idx[sIndex], sIndex); /* set the waypoint index */
- ((WPTHDR *)HxWFile)->used[sIndex] = 0xff; /* Waypoint used */
+ sIndex = le_read16(&((WPTHDR*)HxWFile)->num);
+ ((WPTHDR*)HxWFile)->idx[sIndex] = sIndex; /* set the waypoint index */
+ le_write16(&((WPTHDR*)HxWFile)->idx[sIndex], sIndex); /* set the waypoint index */
+ ((WPTHDR*)HxWFile)->used[sIndex] = 0xff; /* Waypoint used */
/* set Waypoint */
- pWptHxTmp = (WPT *)&HxWFile[OFFS_WPT + (sizeof(WPT) * sIndex)];
+ pWptHxTmp = (WPT*)&HxWFile[OFFS_WPT + (sizeof(WPT) * sIndex)];
memset(pWptHxTmp->name,0x20,sizeof(pWptHxTmp->name));
if (wpt->shortname != NULL) {
le_write32(&pWptHxTmp->pt.iLongitude,(unsigned int) lon);
pWptHxTmp->checked = 01;
pWptHxTmp->vocidx = (short)0xffff;
- le_write16(&((WPTHDR *)HxWFile)->num, ++sIndex);
- le_write16(&((WPTHDR *)HxWFile)->next, ++sIndex);
+ le_write16(&((WPTHDR*)HxWFile)->num, ++sIndex);
+ le_write16(&((WPTHDR*)HxWFile)->next, ++sIndex);
}
short sCount;
/* init the waypoint area*/
- le_write32(&((WPTHDR *)HxWFile)->id, WPT_HDR_ID);
- ((WPTHDR *)HxWFile)->num = 0;
- ((WPTHDR *)HxWFile)->next = 0;
+ le_write32(&((WPTHDR*)HxWFile)->id, WPT_HDR_ID);
+ ((WPTHDR*)HxWFile)->num = 0;
+ ((WPTHDR*)HxWFile)->next = 0;
/* clear index list */
for (sCount = 0; sCount < MAXWPT; sCount++) {
- ((WPTHDR *)HxWFile)->idx[sCount] = (signed short)-1;
+ ((WPTHDR*)HxWFile)->idx[sCount] = (signed short)-1;
}
for (sCount = 0; sCount < MAXWPT; sCount++) {
- ((WPTHDR *)HxWFile)->used[sCount] = 0;
+ ((WPTHDR*)HxWFile)->used[sCount] = 0;
}
/* init the route area */
- le_write32(&((RTEHDR *)&HxWFile[ROUTESTART])->id, RTE_HDR_ID);
- ((RTEHDR *)&HxWFile[ROUTESTART])->num = 0;
- le_write16(&((RTEHDR *)&HxWFile[ROUTESTART])->next, 1);
- ((RTEHDR *)&HxWFile[ROUTESTART])->rteno = (signed short)-1;
+ le_write32(&((RTEHDR*)&HxWFile[ROUTESTART])->id, RTE_HDR_ID);
+ ((RTEHDR*)&HxWFile[ROUTESTART])->num = 0;
+ le_write16(&((RTEHDR*)&HxWFile[ROUTESTART])->next, 1);
+ ((RTEHDR*)&HxWFile[ROUTESTART])->rteno = (signed short)-1;
/* clear index list */
for (sCount = 0; sCount < MAXRTE; sCount++) {
- ((RTEHDR *)&HxWFile[ROUTESTART])->idx[sCount] = (signed short)-1;
+ ((RTEHDR*)&HxWFile[ROUTESTART])->idx[sCount] = (signed short)-1;
}
for (sCount = 0; sCount < MAXRTE; sCount++) {
- ((RTEHDR *)&HxWFile[ROUTESTART])->used[sCount] = 0;
+ ((RTEHDR*)&HxWFile[ROUTESTART])->used[sCount] = 0;
}
waypt_disp_all(holux_disp);
static XML_Parser psr;
#endif
-static char *cdatastr;
+static char* cdatastr;
static int in_Route = 0;
static int in_ChartWork = 0;
static int in_Object = 0;
-static waypoint *wpt_tmp;
-static char *routeName = "ROUTENAME";
+static waypoint* wpt_tmp;
+static char* routeName = "ROUTENAME";
#define REPLACEMENT_SIRIUS_ATTR_SEPARATOR ';'
#define ATTR_USRMRK "usrmrk"
#define ATTR_SHIPNAME "shpnam"
static void readVersion4(gbfile* pFile);
-static void getAttr(const char *data, const char *attr, char **val, char seperator);
+static void getAttr(const char* data, const char* attr, char** val, char seperator);
-static gbfile *fd;
-static gbfile *ofd;
+static gbfile* fd;
+static gbfile* ofd;
static
arglist_t hsa_ndv_args[] = {
#if ! HAVE_LIBEXPAT
static void
-hsa_ndv_rd_init(const char *fname)
+hsa_ndv_rd_init(const char* fname)
{
fatal(MYNAME ": This build excluded HSA Endeavour support because expat was not installed.\n");
}
#else
static void
-hsa_ndv_start(void *data, const XML_Char *xml_el, const XML_Char **attr)
+hsa_ndv_start(void* data, const XML_Char* xml_el, const XML_Char** attr)
{
- const char *el = xml_convert_to_char_string(xml_el);
+ const char* el = xml_convert_to_char_string(xml_el);
// printf("<%s>\n", el);
if (strcmp(el, "Export") == 0) {
}
static void
-hsa_ndv_end(void *data, const XML_Char *xml_el)
+hsa_ndv_end(void* data, const XML_Char* xml_el)
{
- const char *el = xml_convert_to_char_string(xml_el);
+ const char* el = xml_convert_to_char_string(xml_el);
if (in_Route) {
if (strcmp(el, "Version") == 0) {
//don't really care
}
static void
-hsa_ndv_cdata(void *dta, const XML_Char *s, int len)
+hsa_ndv_cdata(void* dta, const XML_Char* s, int len)
{
- char *estr;
+ char* estr;
estr = cdatastr + strlen(cdatastr);
memcpy(estr, s, len);
}
static void
-hsa_ndv_rd_init(const char *fname)
+hsa_ndv_rd_init(const char* fname)
{
fd = gbfopen(fname, "r", MYNAME);
XML_SetUnknownEncodingHandler(psr, cet_lib_expat_UnknownEncodingHandler, NULL);
XML_SetElementHandler(psr, hsa_ndv_start, hsa_ndv_end);
- cdatastr = xcalloc(MY_CBUF,1);
+ cdatastr = (char*) xcalloc(MY_CBUF,1);
XML_SetCharacterDataHandler(psr, hsa_ndv_cdata);
}
char buf[MY_CBUF + 1];
while ((len = gbfread(buf, 1, sizeof(buf) - 1, fd))) {
- char *bad;
+ char* bad;
buf[len] = '\0';
if (NULL != strstr(buf, "nver=1")) {
#endif
-static void getAttr(const char *data, const char *attr, char **val, char seperator)
+static void getAttr(const char* data, const char* attr, char** val, char seperator)
{
- char *start;
+ char* start;
if ((start = strstr(data, attr)) != NULL) {
- char *end;
+ char* end;
int len;
end = strchr(start, seperator);
len = end-start - strlen(attr);
- *val = xcalloc(len+1, 1);
+ *val = (char*) xcalloc(len+1, 1);
memcpy(*val, start+strlen(attr), len);
(*val)[len] = '\0';
} else {
- *val = xcalloc(1, 1);
+ *val = (char*) xcalloc(1, 1);
(*val)[0] = '\0';
}
}
}
static void
-hsa_ndv_wr_init(const char *fname)
+hsa_ndv_wr_init(const char* fname)
{
ofd = gbfopen(fname, "w", MYNAME);
}
static int legNum = 0;
static void
-hsa_ndv_waypt_pr(const waypoint *waypointp)
+hsa_ndv_waypt_pr(const waypoint* waypointp)
{
gbfprintf(ofd, "\t\t<Object>\n");
#define INVALID_TIME -1L
#define SOUNDARRAY_CHAR 'S'
-static int readRecord(gbfile* pFile, const char* pRecName, char *recData);
+static int readRecord(gbfile* pFile, const char* pRecName, char* recData);
static int readPositionRecord(gbfile* pFile, double* lat, double* lng, long* timeStamp);
static void readVersion4(gbfile* pFile)
sscanf((const char*)recData, "%d", &numberOfVerticies);
// do we have a sounding array
- if (*((const char *)recData + strlen(recData) - 1) == SOUNDARRAY_CHAR) {
+ if (*((const char*)recData + strlen(recData) - 1) == SOUNDARRAY_CHAR) {
soundArray = TRUE;
}
getAttr(attr, ATTR_USRMRK, &wpt_tmp->description, '\x1f');
{
- char *bad;
+ char* bad;
//remove \n and \x1f from description data
while (NULL != (bad = strchr(wpt_tmp->description, '\x1f'))) {
*bad = REPLACEMENT_SIRIUS_ATTR_SEPARATOR;
}
// read a record to a file
-static int readRecord(gbfile* pFile, const char* pRecName, char *recData)
+static int readRecord(gbfile* pFile, const char* pRecName, char* recData)
{
// get the rec name
int len;
#include "jeeps/gpsmath.h"
#include <ctype.h>
-static gbfile *file_out;
+static gbfile* file_out;
static short_handle mkshort_handle;
-static char *stylesheet = NULL;
-static char *html_encrypt = NULL;
-static char *includelogs = NULL;
-static char *degformat = NULL;
-static char *altunits = NULL;
+static char* stylesheet = NULL;
+static char* html_encrypt = NULL;
+static char* includelogs = NULL;
+static char* degformat = NULL;
+static char* altunits = NULL;
#define MYNAME "HTML"
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
file_out = gbfopen(fname, "w", MYNAME);
mkshort_handle = mkshort_new_handle();
}
static void
-html_disp(const waypoint *wpt)
+html_disp(const waypoint* wpt)
{
char tbuf[1024];
- char *cout;
+ char* cout;
time_t tm = wpt->creation_time;
gbint32 utmz;
double utme, utmn;
char utmzc;
- fs_xml *fs_gpx = NULL;
+ fs_xml* fs_gpx = NULL;
GPS_Math_WGS84_To_UTM_EN(wpt->latitude, wpt->longitude,
gbfprintf(file_out, "<br>\n");
if (strcmp(wpt->description, wpt->shortname)) {
if (wpt->url) {
- char *d = html_entitize(wpt->description);
+ char* d = html_entitize(wpt->description);
gbfprintf(file_out, "<a href=\"%s\">%s</a>", wpt->url, d);
xfree(d);
} else {
gbfprintf(file_out, "<tr><td colspan=\"2\">");
if (wpt->gc_data->desc_short.utfstring) {
- char *tmpstr = strip_nastyhtml(wpt->gc_data->desc_short.utfstring);
+ char* tmpstr = strip_nastyhtml(wpt->gc_data->desc_short.utfstring);
gbfprintf(file_out, "<p class=\"gpsbabeldescshort\">%s</p>\n", tmpstr);
xfree(tmpstr);
}
if (wpt->gc_data->desc_long.utfstring) {
- char *tmpstr = strip_nastyhtml(wpt->gc_data->desc_long.utfstring);
+ char* tmpstr = strip_nastyhtml(wpt->gc_data->desc_long.utfstring);
gbfprintf(file_out, "<p class=\"gpsbabeldesclong\">%s</p>\n", tmpstr);
xfree(tmpstr);
}
if (wpt->gc_data->hint) {
- char *hint = NULL;
+ char* hint = NULL;
if (html_encrypt) {
hint = rot13(wpt->gc_data->hint);
} else {
fs_gpx = NULL;
if (includelogs) {
- fs_gpx = (fs_xml *)fs_chain_find(wpt->fs, FS_GPX);
+ fs_gpx = (fs_xml*)fs_chain_find(wpt->fs, FS_GPX);
}
if (fs_gpx && fs_gpx->tag) {
- xml_tag *root = fs_gpx->tag;
- xml_tag *curlog = NULL;
- xml_tag *logpart = NULL;
+ xml_tag* root = fs_gpx->tag;
+ xml_tag* curlog = NULL;
+ xml_tag* logpart = NULL;
curlog = xml_findfirst(root, "groundspeak:log");
while (curlog) {
time_t logtime = 0;
- struct tm *logtm = NULL;
+ struct tm* logtm = NULL;
gbfprintf(file_out, "<p class=\"gpsbabellog\">\n");
logpart = xml_findfirst(curlog, "groundspeak:type");
logpart = xml_findfirst(curlog, "groundspeak:finder");
if (logpart) {
- char *f = html_entitize(logpart->cdata);
+ char* f = html_entitize(logpart->cdata);
gbfprintf(file_out, "<span class=\"gpsbabellogfinder\">%s</span> on ", f);
xfree(f);
}
logpart = xml_findfirst(curlog, "groundspeak:log_wpt");
if (logpart) {
- char *coordstr = NULL;
+ char* coordstr = NULL;
float lat = 0;
float lon = 0;
coordstr = xml_attribute(logpart, "lat");
logpart = xml_findfirst(curlog, "groundspeak:text");
if (logpart) {
- char *encstr = NULL;
- char *s = NULL;
- char *t = NULL;
+ char* encstr = NULL;
+ char* s = NULL;
+ char* t = NULL;
int encoded = 0;
encstr = xml_attribute(logpart, "encoded");
encoded = (encstr[0] != 'F');
}
static void
-html_index(const waypoint *wpt)
+html_index(const waypoint* wpt)
{
- char *sn = html_entitize(wpt->shortname);
- char *d = html_entitize(wpt->description);
+ char* sn = html_entitize(wpt->shortname);
+ char* d = html_entitize(wpt->description);
gbfprintf(file_out, "<a href=\"#%s\">%s - %s</a><br>\n", sn, sn, d);
static gbfile* fout;
static int waypoint_num;
static short_handle wptname_sh, rtename_sh, trkname_sh;
-static avltree_t *waypoints;
-static humminbird_rte_t *humrte;
+static avltree_t* waypoints;
+static humminbird_rte_t* humrte;
static int rte_num;
static
*******************************************************************************/
static void
-humminbird_rd_init(const char *fname)
+humminbird_rd_init(const char* fname)
{
fin = gbfopen_be(fname, "rb", MYNAME);
waypoints = avltree_init(0, MYNAME);
humminbird_waypt_t w;
double guder;
int num_icons;
- waypoint *wpt;
+ waypoint* wpt;
char buff[10];
if (! gbfread(&w, 1, sizeof(w), fin)) {
if (hrte.count > 0) {
int i;
- route_head *rte = NULL;
+ route_head* rte = NULL;
for (i = 0; i < hrte.count; i++) {
- waypoint *wpt;
+ waypoint* wpt;
char buff[10];
hrte.points[i] = be_read16(&hrte.points[i]);
/* locate the point over his internal Humminbird "Number" */
snprintf(buff, sizeof(buff), "%d", hrte.points[i]);
- if (avltree_find(waypoints, buff, (void *) &wpt)) {
+ if (avltree_find(waypoints, buff, (const void**) &wpt)) {
if (rte == NULL) {
rte = route_head_alloc();
route_add_head(rte);
/* num_points is actually one too big, because it includes the value in
the header. But we want the extra point at the end because the
freak-value filter below looks at points[i+1] */
- points = xcalloc(th.num_points, sizeof(humminbird_trk_point_t));
+ points = (humminbird_trk_point_t*) xcalloc(th.num_points, sizeof(humminbird_trk_point_t));
if (! gbfread(points, sizeof(humminbird_trk_point_t), th.num_points-1, fin)) {
fatal(MYNAME ": Unexpected end of file reading points!\n");
}
track_add_wpt(trk, first_wpt);
for (i=0 ; i<th.num_points-1 ; i++) {
- waypoint *wpt = waypt_new();
+ waypoint* wpt = waypt_new();
gbint16 next_deltaeast, next_deltanorth;
double guder;
/* num_points is actually one too big, because it includes the value in
the header. But we want the extra point at the end because the
freak-value filter below looks at points[i+1] */
- points = xcalloc(th.num_points, sizeof(humminbird_trk_point_old_t));
+ points = (humminbird_trk_point_old_t*)xcalloc(th.num_points, sizeof(humminbird_trk_point_old_t));
if (! gbfread(points, sizeof(humminbird_trk_point_old_t), th.num_points-1, fin)) {
fatal(MYNAME ": Unexpected end of file reading points!\n");
}
track_add_wpt(trk, first_wpt);
for (i=0 ; i<th.num_points-1 ; i++) {
- waypoint *wpt = waypt_new();
+ waypoint* wpt = waypt_new();
// gbint16 next_deltaeast, next_deltanorth;
double guder;
/************************************************************************************************/
static void
-humminbird_wr_init(const char *fname)
+humminbird_wr_init(const char* fname)
{
fout = gbfopen_be(fname, "wb", MYNAME);
}
static void
-humminbird_write_waypoint(const waypoint *wpt)
+humminbird_write_waypoint(const waypoint* wpt)
{
humminbird_waypt_t hum;
double lat, north, east;
int i;
int num_icons = sizeof(humminbird_icons) / sizeof(humminbird_icons[0]);
- char *name;
+ char* name;
be_write16(&hum.num, waypoint_num++);
hum.zero = 0;
if (hum.icon == 255) { /* no success, no try to find the item in a more comlex name */
hum.icon = 0; /* i.e. "Diamond" as part of "Diamond, Green" or "Green Diamond" */
for (i = 0; i < num_icons; i++) {
- char *match;
+ char* match;
int j;
xasprintf(&match, "*%s*", humminbird_icons[i]);
j = case_ignore_str_match(wpt->icon_descr, match);
static void
-humminbird_track_head(const route_head *trk)
+humminbird_track_head(const route_head* trk)
{
int max_points = (131080 - sizeof(gbuint32)- sizeof(humminbird_trk_header_t)) / sizeof(humminbird_trk_point_t);
trk_head = NULL;
last_time = 0;
if (trk->rte_waypt_ct > 0) {
- char *name;
- trk_head = xcalloc(1, sizeof(humminbird_trk_header_t));
- trk_points = xcalloc(max_points, sizeof(humminbird_trk_point_t));
+ char* name;
+ trk_head = (humminbird_trk_header_t*) xcalloc(1, sizeof(humminbird_trk_header_t));
+ trk_points = (humminbird_trk_point_t*) xcalloc(max_points, sizeof(humminbird_trk_point_t));
name = mkshort(trkname_sh, trk->rte_name);
strncpy(trk_head->name, name, sizeof(trk_head->name));
}
static void
-humminbird_track_tail(const route_head *rte)
+humminbird_track_tail(const route_head* rte)
{
int max_points = (131080 - sizeof(gbuint32)- sizeof(humminbird_trk_header_t)) / sizeof(humminbird_trk_point_t);
}
static void
-humminbird_track_cb(const waypoint *wpt)
+humminbird_track_cb(const waypoint* wpt)
{
gbint32 north, east;
double lat;
}
static void
-humminbird_rte_head(const route_head *rte)
+humminbird_rte_head(const route_head* rte)
{
humrte = NULL;
if (rte->rte_waypt_ct > 0) {
- humrte = xcalloc(1, sizeof(*humrte));
+ humrte = (humminbird_rte_t*) xcalloc(1, sizeof(*humrte));
}
}
static void
-humminbird_rte_tail(const route_head *rte)
+humminbird_rte_tail(const route_head* rte)
{
if (humrte == NULL) {
return;
if (humrte->count > 0) {
int i;
- char *name;
+ char* name;
humrte->num = rte_num++;
humrte->time = gpsbabel_time;
}
static void
-humminbird_write_rtept(const waypoint *wpt)
+humminbird_write_rtept(const waypoint* wpt)
{
int i;
}
static void
-humminbird_write_waypoint_wrapper(const waypoint *wpt)
+humminbird_write_waypoint_wrapper(const waypoint* wpt)
{
- char *key;
- waypoint *tmpwpt;
+ char* key;
+ waypoint* tmpwpt;
xasprintf(&key, "%s\01%.9f\01%.9f", wpt->shortname, wpt->latitude, wpt->longitude);
- if (! avltree_find(waypoints, key, (void *)&tmpwpt)) {
- tmpwpt = (waypoint *)wpt;
+ if (! avltree_find(waypoints, key, (const void**)&tmpwpt)) {
+ tmpwpt = (waypoint*)wpt;
avltree_insert(waypoints, key, wpt);
tmpwpt->extra_data = gb_int2ptr(waypoint_num + 1); /* NOT NULL */
humminbird_write_waypoint(wpt);
} else {
- void *p = tmpwpt->extra_data;
- tmpwpt = (waypoint *)wpt;
+ void* p = tmpwpt->extra_data;
+ tmpwpt = (waypoint*)wpt;
tmpwpt->extra_data = p;
}
ff_vecs_t humminbird_vecs = {
ff_type_file,
{
- ff_cap_read | ff_cap_write /* waypoints */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */,
ff_cap_read /* tracks */,
- ff_cap_read | ff_cap_write /* routes */
+ (ff_cap)(ff_cap_read | ff_cap_write) /* routes */
},
humminbird_rd_init,
humminbird_wr_init,
ff_type_file,
{
ff_cap_read /* waypoints */,
- ff_cap_read | ff_cap_write /* tracks */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */,
ff_cap_read /* routes */
},
humminbird_rd_init,
#include "defs.h"
#include <errno.h>
-static gbfile *file_in, *file_out;
+static gbfile* file_in, *file_out;
static char manufacturer[4];
-static const route_head *head;
-static char *timeadj = NULL;
+static const route_head* head;
+static char* timeadj = NULL;
static int lineno;
#define MYNAME "IGC"
* @param rec Caller allocated storage for the record. At least MAXRECLEN chars must be allocated.
* @return the record type. rec_none on EOF, rec_bad on fgets() or parse error.
*/
-static igc_rec_type_t get_record(char **rec)
+static igc_rec_type_t get_record(char** rec)
{
size_t len;
- char *c;
+ char* c;
retry:
*rec = c = gbfgetstr(file_in);
if ((lineno++ == 0) && file_in->unicode) {
return (igc_rec_type_t) c[0];
}
-static void rd_init(const char *fname)
+static void rd_init(const char* fname)
{
- char *ibuf;
+ char* ibuf;
file_in = gbfopen(fname, "r", MYNAME);
lineno = 0;
* A route is created for each set of waypoints in a task declaration.
* @param rec A single task record
*/
-static void igc_task_rec(const char *rec)
+static void igc_task_rec(const char* rec)
{
static char flight_date[7];
static unsigned int num_tp, tp_ct;
- static route_head *rte_head;
+ static route_head* rte_head;
static time_t creation;
char task_num[5];
char task_desc[MAXRECLEN];
- waypoint *wpt;
+ waypoint* wpt;
unsigned int lat_deg, lat_min, lat_frac;
unsigned int lon_deg, lon_min, lon_frac;
char lat_hemi[2], lon_hemi[2];
static void data_read(void)
{
- char *ibuf;
+ char* ibuf;
igc_rec_type_t rec_type;
unsigned int hours, mins, secs;
unsigned int lat_deg, lat_min, lat_frac;
unsigned int lon_deg, lon_min, lon_frac;
char lat_hemi[2], lon_hemi[2];
char validity;
- route_head *pres_head = NULL;
- route_head *gnss_head = NULL;
+ route_head* pres_head = NULL;
+ route_head* gnss_head = NULL;
int pres_alt, gnss_alt;
char pres_valid = 0;
char gnss_valid = 0;
- waypoint *pres_wpt = NULL;
- waypoint *gnss_wpt = NULL;
+ waypoint* pres_wpt = NULL;
+ waypoint* gnss_wpt = NULL;
time_t date = 0;
time_t prev_tod = 0;
time_t tod;
struct tm tm;
char tmp_str[20];
- char *hdr_data;
+ char* hdr_data;
size_t remain;
char trk_desc[MAXDESCLEN + 1];
* Callbacks used to scan for specific track types
*/
-static void detect_pres_track(const route_head * rh)
+static void detect_pres_track(const route_head* rh)
{
if (rh->rte_name && strncmp(rh->rte_name, PRESTRKNAME, 6) == 0) {
head = rh;
}
}
-static void detect_gnss_track(const route_head * rh)
+static void detect_gnss_track(const route_head* rh)
{
if (rh->rte_name && strncmp(rh->rte_name, GNSSTRKNAME, 6) == 0) {
head = rh;
}
}
-static void detect_other_track(const route_head * rh)
+static void detect_other_track(const route_head* rh)
{
static int max_waypt_ct;
* @param gnss_track Set by the function to the GNSS altitude track
* head. NULL if not found.
*/
-static void get_tracks(const route_head ** pres_track, const route_head ** gnss_track)
+static void get_tracks(const route_head** pres_track, const route_head** gnss_track)
{
head = NULL;
track_disp_all(detect_pres_track, NULL, NULL);
* IGC string formatting functions
*/
-static char *latlon2str(const waypoint * wpt)
+static char* latlon2str(const waypoint* wpt)
{
static char str[18] = "";
char lat_hemi = wpt->latitude < 0 ? 'S' : 'N';
return str;
}
-static char *date2str(struct tm *dt)
+static char* date2str(struct tm* dt)
{
static char str[7] = "";
return str;
}
-static char *tod2str(struct tm *tod)
+static char* tod2str(struct tm* tod)
{
static char str[7] = "";
*/
static void wr_header(void)
{
- const route_head *pres_track;
- const route_head *track;
- struct tm *tm;
+ const route_head* pres_track;
+ const route_head* track;
+ struct tm* tm;
time_t date;
static const char dflt_str[] = "Unknown";
- const char *str;
- waypoint *wpt;
+ const char* str;
+ waypoint* wpt;
get_tracks(&pres_track, &track);
if (!track && pres_track) {
}
// Date in header record is that of the first fix record
date = !track ? current_time() :
- ((waypoint *) QUEUE_FIRST(&track->waypoint_list))->creation_time;
+ ((waypoint*) QUEUE_FIRST(&track->waypoint_list))->creation_time;
if (NULL == (tm = gmtime(&date))) {
fatal(MYNAME ": Bad track timestamp\n");
* Generation of IGC task declaration records
*/
-static void wr_task_wpt_name(const waypoint * wpt, const char *alt_name)
+static void wr_task_wpt_name(const waypoint* wpt, const char* alt_name)
{
gbfprintf(file_out, "C%s%s\r\n", latlon2str(wpt),
wpt->description ? wpt->description : wpt->shortname ? wpt->shortname : alt_name);
}
-static void wr_task_hdr(const route_head * rte)
+static void wr_task_hdr(const route_head* rte)
{
unsigned char have_takeoff = 0;
- const waypoint *wpt;
+ const waypoint* wpt;
char flight_date[7] = "000000";
char task_desc[MAXRECLEN] = "";
int num_tps = rte->rte_waypt_ct - 2;
- struct tm *tm;
+ struct tm* tm;
time_t rte_time;
static unsigned int task_num = 1;
}
// See if the takeoff and landing waypoints are there or if we need to
// generate them.
- wpt = (waypoint *) QUEUE_LAST(&rte->waypoint_list);
+ wpt = (waypoint*) QUEUE_LAST(&rte->waypoint_list);
if (wpt->shortname && strncmp(wpt->shortname, "LANDING", 6) == 0) {
num_tps--;
}
- wpt = (waypoint *) QUEUE_FIRST(&rte->waypoint_list);
+ wpt = (waypoint*) QUEUE_FIRST(&rte->waypoint_list);
if (wpt->shortname && strncmp(wpt->shortname, "TAKEOFF", 6) == 0) {
have_takeoff = 1;
num_tps--;
}
}
-static void wr_task_wpt(const waypoint * wpt)
+static void wr_task_wpt(const waypoint* wpt)
{
wr_task_wpt_name(wpt, "");
}
-static void wr_task_tlr(const route_head * rte)
+static void wr_task_tlr(const route_head* rte)
{
// If the landing waypoint is not supplied we need to generate it.
- const waypoint *wpt = (waypoint *) QUEUE_LAST(&rte->waypoint_list);
+ const waypoint* wpt = (waypoint*) QUEUE_LAST(&rte->waypoint_list);
if (!wpt->shortname || strncmp(wpt->shortname, "LANDIN", 6) != 0) {
wr_task_wpt_name(wpt, "LANDING");
}
/*
* Write a single fix record
*/
-static void wr_fix_record(const waypoint * wpt, int pres_alt, int gnss_alt)
+static void wr_fix_record(const waypoint* wpt, int pres_alt, int gnss_alt)
{
- struct tm *tm;
+ struct tm* tm;
if (NULL == (tm = gmtime(&wpt->creation_time))) {
fatal(MYNAME ": bad track timestamp\n");
* @return The number of seconds to add to the GNSS track in order to align
* it with the pressure track.
*/
-static int correlate_tracks(const route_head * pres_track, const route_head * gnss_track)
+static int correlate_tracks(const route_head* pres_track, const route_head* gnss_track)
{
- const queue *elem;
+ const queue* elem;
double last_alt, alt_diff;
double speed;
time_t pres_time, gnss_time;
int time_diff;
- const waypoint *wpt;
+ const waypoint* wpt;
// Deduce the landing time from the pressure altitude track based on
// when we last descended to within 10m of the final track altitude.
elem = QUEUE_LAST(&pres_track->waypoint_list);
- last_alt = ((waypoint *) elem)->altitude;
+ last_alt = ((waypoint*) elem)->altitude;
do {
elem = elem->prev;
if (&pres_track->waypoint_list == elem) {
// No track left
return 0;
}
- alt_diff = last_alt - ((waypoint *) elem)->altitude;
+ alt_diff = last_alt - ((waypoint*) elem)->altitude;
if (alt_diff > 10.0) {
// Last part of track was ascending
return 0;
}
} while (alt_diff > -10.0);
- pres_time = ((waypoint *) elem->next)->creation_time;
+ pres_time = ((waypoint*) elem->next)->creation_time;
if (global_opts.debug_level >= 1) {
printf(MYNAME ": pressure landing time %s", ctime(&pres_time));
}
// Deduce the landing time from the GNSS altitude track based on
// when the groundspeed last dropped below a certain level.
elem = QUEUE_LAST(&gnss_track->waypoint_list);
- last_alt = ((waypoint *) elem)->altitude;
+ last_alt = ((waypoint*) elem)->altitude;
do {
- wpt = (waypoint *) elem;
+ wpt = (waypoint*) elem;
elem = elem->prev;
if (&gnss_track->waypoint_list == elem) {
// No track left
return 0;
}
// Get a crude indication of groundspeed from the change in lat/lon
- time_diff = wpt->creation_time - ((waypoint *) elem)->creation_time;
+ time_diff = wpt->creation_time - ((waypoint*) elem)->creation_time;
speed = !time_diff ? 0 :
- (fabs(wpt->latitude - ((waypoint *) elem)->latitude) +
- fabs(wpt->longitude - ((waypoint *) elem)->longitude)) / time_diff;
+ (fabs(wpt->latitude - ((waypoint*) elem)->latitude) +
+ fabs(wpt->longitude - ((waypoint*) elem)->longitude)) / time_diff;
if (global_opts.debug_level >= 2) {
printf(MYNAME ": speed=%f\n", speed);
}
} while (speed < 0.00003);
- gnss_time = ((waypoint *) elem->next)->creation_time;
+ gnss_time = ((waypoint*) elem->next)->creation_time;
if (global_opts.debug_level >= 1) {
printf(MYNAME ": gnss landing time %s", ctime(&gnss_time));
}
* @param time The time that we are interested in.
* @return The altitude interpolated from the track.
*/
-static double interpolate_alt(const route_head * track, time_t time)
+static double interpolate_alt(const route_head* track, time_t time)
{
- static const queue *prev_elem = NULL;
- static const queue *curr_elem = NULL;
- const waypoint *prev_wpt;
- const waypoint *curr_wpt;
+ static const queue* prev_elem = NULL;
+ static const queue* curr_elem = NULL;
+ const waypoint* prev_wpt;
+ const waypoint* curr_wpt;
int time_diff;
double alt_diff;
curr_elem = prev_elem = QUEUE_FIRST(&track->waypoint_list);
}
// Find the track points either side of the requested time
- while (((waypoint *) curr_elem)->creation_time < time) {
+ while (((waypoint*) curr_elem)->creation_time < time) {
if (QUEUE_LAST(&track->waypoint_list) == curr_elem) {
// Requested time later than all track points, we can't interpolate
return unknown_alt;
curr_elem = QUEUE_NEXT(prev_elem);
}
- prev_wpt = (waypoint *) prev_elem;
- curr_wpt = (waypoint *) curr_elem;
+ prev_wpt = (waypoint*) prev_elem;
+ curr_wpt = (waypoint*) curr_elem;
if (QUEUE_FIRST(&track->waypoint_list) == curr_elem) {
if (curr_wpt->creation_time == time) {
*/
static void wr_track(void)
{
- const route_head *pres_track;
- const route_head *gnss_track;
- const waypoint *wpt;
- const queue *elem;
- const queue *tmp;
+ const route_head* pres_track;
+ const route_head* gnss_track;
+ const waypoint* wpt;
+ const queue* elem;
+ const queue* tmp;
int time_adj;
double pres_alt;
}
// Iterate through waypoints in both tracks simultaneously
QUEUE_FOR_EACH(&gnss_track->waypoint_list, elem, tmp) {
- wpt = (waypoint *) elem;
+ wpt = (waypoint*) elem;
pres_alt = interpolate_alt(pres_track, wpt->creation_time + time_adj);
wr_fix_record(wpt, (int) pres_alt, (int) wpt->altitude);
}
// Only the pressure altitude track was found so generate fix
// records from it alone.
QUEUE_FOR_EACH(&pres_track->waypoint_list, elem, tmp) {
- wr_fix_record((waypoint *) elem, (int)((waypoint *) elem)->altitude, (int) unknown_alt);
+ wr_fix_record((waypoint*) elem, (int)((waypoint*) elem)->altitude, (int) unknown_alt);
}
} else if (gnss_track) {
// Only the GNSS altitude track was found so generate fix
// records from it alone.
QUEUE_FOR_EACH(&gnss_track->waypoint_list, elem, tmp) {
- wr_fix_record((waypoint *) elem, (int) unknown_alt, (int)((waypoint *) elem)->altitude);
+ wr_fix_record((waypoint*) elem, (int) unknown_alt, (int)((waypoint*) elem)->altitude);
}
} else {
// No tracks found so nothing to do
}
}
-static void wr_init(const char *fname)
+static void wr_init(const char* fname)
{
file_out = gbfopen(fname, "wb", MYNAME);
}
ff_vecs_t igc_vecs = {
ff_type_file,
- { ff_cap_none , ff_cap_read | ff_cap_write, ff_cap_read | ff_cap_write },
+ { ff_cap_none , (ff_cap)(ff_cap_read | ff_cap_write), (ff_cap)(ff_cap_read | ff_cap_write) },
rd_init,
wr_init,
rd_deinit,
#define MYNAME "IGNRando"
-static gbfile *fout;
+static gbfile* fout;
-static route_head *track;
-static waypoint *wpt;
+static route_head* track;
+static waypoint* wpt;
static int track_index; /* index of track we'll write */
static int track_num; /* current index of track within track_disp_all */
static int xmlpoints;
/* options */
-static char *index_opt = NULL;
+static char* index_opt = NULL;
static arglist_t ignr_args[] = {
{"index", &index_opt, "Index of track to write (if more than one in source)", NULL, ARGTYPE_INT, "1", NULL },
#if ! HAVE_LIBEXPAT
static void
-ignr_rd_init(const char *fname)
+ignr_rd_init(const char* fname)
{
fatal(MYNAME ": This build excluded \"" MYNAME "\" input support because expat was not installed.\n");
}
{ ignr_etape_end, cb_end, "/RANDONNEE/ETAPE" },
{ ignr_etape_pos, cb_cdata, "/RANDONNEE/ETAPE/POSITION" },
{ ignr_etape_alt, cb_cdata, "/RANDONNEE/ETAPE/ALTITUDE" },
- { NULL, 0, NULL }
+ { NULL, (xg_cb_type)0, NULL }
};
static void
static xg_callback ignr_etape_begin, ignr_etape_end;
static void
-ignr_start(const char *args, const char **attrv)
+ignr_start(const char* args, const char** attrv)
{
ignr_xml_error((track != NULL));
}
static void
-ignr_nb_etapes(const char *args, const char **attrv)
+ignr_nb_etapes(const char* args, const char** attrv)
{
xmlpoints = atoi(args);
}
static void
-ignr_descr(const char *args, const char **attrv)
+ignr_descr(const char* args, const char** attrv)
{
ignr_xml_error((track == NULL));
}
static void
-ignr_etape_begin(const char *args, const char **attrv)
+ignr_etape_begin(const char* args, const char** attrv)
{
ignr_xml_error((wpt != NULL));
}
static void
-ignr_etape_end(const char *args, const char **attrv)
+ignr_etape_end(const char* args, const char** attrv)
{
ignr_xml_error((track == NULL) || (wpt == NULL));
}
static void
-ignr_etape_pos(const char *args, const char **attrv)
+ignr_etape_pos(const char* args, const char** attrv)
{
ignr_xml_error((wpt == NULL) || (args == NULL));
}
static void
-ignr_etape_alt(const char *args, const char **attrv)
+ignr_etape_alt(const char* args, const char** attrv)
{
ignr_xml_error((wpt == NULL));
if (args == NULL) {
/* callbacks registered in ignr_vecs */
static void
-ignr_rd_init(const char *fname)
+ignr_rd_init(const char* fname)
{
xml_init(fname, ignr_xml_map, NULL);
wpt = NULL;
/* callbacks registered in ignr_vecs */
static void
-ignr_rw_init(const char *fname)
+ignr_rw_init(const char* fname)
{
fout = gbfopen(fname, "w", MYNAME);
}
}
static void
-ignr_write_track_hdr(const route_head *track)
+ignr_write_track_hdr(const route_head* track)
{
track_num++;
}
static void
-ignr_write_track_trl(const route_head *track)
+ignr_write_track_trl(const route_head* track)
{
}
static void
-ignr_write_waypt(const waypoint *wpt)
+ignr_write_waypt(const waypoint* wpt)
{
if (track_num != track_index) {
return;
ff_vecs_t ignr_vecs = {
ff_type_file,
- { ff_cap_none, ff_cap_read | ff_cap_write, ff_cap_none },
+ { ff_cap_none, (ff_cap)(ff_cap_read | ff_cap_write), ff_cap_none },
ignr_rd_init,
ignr_rw_init,
ignr_rd_deinit,
} igo8_point, *p_igo8_point;
// Files
-static gbfile *igo8_file_in;
-static gbfile *igo8_file_out;
+static gbfile* igo8_file_in;
+static gbfile* igo8_file_out;
// Options
static char* igo8_option_tracknum = NULL;
}
// Reader initialization callback
-static void igo8_read_init(const char *fname)
+static void igo8_read_init(const char* fname)
{
igo8_file_in = gbfopen_le(fname, "rb", MYNAME);
// Reader callback
static void igo8_read(void)
{
- waypoint *wpt_tmp;
- route_head *track_head;
+ waypoint* wpt_tmp;
+ route_head* track_head;
igo8_point point;
track_head = route_head_alloc();
}
// Writer initialize callback
-static void igo8_write_init(const char *fname)
+static void igo8_write_init(const char* fname)
{
igo8_file_out = gbfopen_le(fname, "wb", MYNAME);
}
// Write point callback
-static void write_igo8_track_point(const waypoint *wpt)
+static void write_igo8_track_point(const waypoint* wpt)
{
igo8_point point;
// Write src unicode str to the dst cstring using unicode characters
// All lengths are in bytes
-unsigned int print_unicode(char *dst, const unsigned int dst_max_length, short *src, unsigned int src_len)
+unsigned int print_unicode(char* dst, const unsigned int dst_max_length, short* src, unsigned int src_len)
{
// Check to see what length we were passed, if the length doesn't include the null
// then we make it include the null
// string, validate that the use of the CET library provides
// conmforming output, remove my old junk converter code.
-unsigned int ascii_to_unicode_2(char *dst, const unsigned int dst_max_length, const char *src)
+unsigned int ascii_to_unicode_2(char* dst, const unsigned int dst_max_length, const char* src)
{
- short *unicode;
+ short* unicode;
int len;
unicode = cet_str_any_to_uni(src, &cet_cs_vec_ansi_x3_4_1968, &len);
// Callback definitions
ff_vecs_t igo8_vecs = {
ff_type_file,
- { ff_cap_none, ff_cap_read | ff_cap_write, ff_cap_none },
+ { ff_cap_none, (ff_cap)(ff_cap_read | ff_cap_write), ff_cap_none },
igo8_read_init,
igo8_write_init,
igo8_read_deinit,
#define MYNAME "ikt"
-static char *name, *text;
+static char* name, *text;
#if ! HAVE_LIBEXPAT
void
-ikt_rd_init(const char *fname)
+ikt_rd_init(const char* fname)
{
fatal(MYNAME ": This build excluded \" MYNAME \" support because expat was not installed.\n");
}
#else
-static route_head *track;
-static waypoint *waypt;
+static route_head* track;
+static waypoint* waypt;
static xg_callback iktobj_waypt, iktobj_type, iktobj_name, iktobj_trkpt, iktobj_text;
{ iktobj_waypt, cb_start, IKTOBJ "_*/GeoPosition" },
{ iktobj_name, cb_cdata, IKTOBJ "_*/Name" },
{ iktobj_text, cb_cdata, IKTOBJ "_*/POIDrawable2D/Text" },
- { NULL, 0, NULL }
+ { NULL, (xg_cb_type)0, NULL }
};
static void
}
static void
-iktobj_waypt(const char *args, const char **attrv)
+iktobj_waypt(const char* args, const char** attrv)
{
- const char **avp = &attrv[0];
+ const char** avp = &attrv[0];
while (*avp) {
if (strcmp(avp[0], "X") == 0) {
}
static void
-iktobj_trkpt(const char *args, const char **attrv)
+iktobj_trkpt(const char* args, const char** attrv)
{
- const char **avp = &attrv[0];
+ const char** avp = &attrv[0];
waypt = waypt_new();
while (*avp) {
}
static void
-iktobj_name(const char *args, const char **unused)
+iktobj_name(const char* args, const char** unused)
{
name = xstrdup(args);
}
static void
-iktobj_text(const char *args, const char **unused)
+iktobj_text(const char* args, const char** unused)
{
text = xstrdup(args);
}
static void
-iktobj_type(const char *args, const char **unused)
+iktobj_type(const char* args, const char** unused)
{
ikt_object_end();
}
static void
-ikt_rd_init(const char *fname)
+ikt_rd_init(const char* fname)
{
xml_init(fname, ikt_map, NULL);
typedef struct inifile_entry_s {
queue Q;
- char *key;
- char *val;
+ char* key;
+ char* val;
} inifile_entry_t;
typedef struct inifile_section_s {
queue Q;
- char *name;
+ char* name;
int ientries;
queue entries;
} inifile_section_t;
#define GPSBABEL_INIFILE "gpsbabel.ini"
/* Remember the filename we used so we can include it in errors. */
-char *gbinipathname;
+char* gbinipathname;
-static char *
-find_gpsbabel_inifile(const char *path) /* can be empty or NULL */
+static char*
+find_gpsbabel_inifile(const char* path) /* can be empty or NULL */
{
- FILE *test;
- char *buff;
+ FILE* test;
+ char* buff;
int len;
if (path == NULL) {
return NULL;
}
-static gbfile *
+static gbfile*
open_gpsbabel_inifile(void)
{
- char *name;
- char *envstr;
- gbfile *res = NULL;
+ char* name;
+ char* envstr;
+ gbfile* res = NULL;
envstr = getenv("GPSBABELINI");
if (envstr != NULL) {
- FILE *test;
+ FILE* test;
test = fopen(envstr, "r");
if (test != NULL) {
}
#else
if ((envstr = getenv("HOME")) != NULL) {
- char *path;
+ char* path;
path = (char*) xmalloc(strlen(envstr) + 11);
strcpy(path, envstr);
}
static void
-inifile_load_file(gbfile *fin, inifile_t *inifile, const char *myname)
+inifile_load_file(gbfile* fin, inifile_t* inifile, const char* myname)
{
- char *buf;
- inifile_section_t *sec = NULL;
+ char* buf;
+ inifile_section_t* sec = NULL;
int line = 0;
while ((buf = gbfgetstr(fin))) {
- char *cin = lrtrim(buf);
+ char* cin = lrtrim(buf);
if ((line++ == 0) && fin->unicode) {
inifile->unicode = 1;
if (*cin == '[') {
- char *cend = strchr(++cin, ']');
+ char* cend = strchr(++cin, ']');
if (cend != NULL) {
*cend = '\0';
fatal("%s: invalid section header '%s' in '%s'.\n", myname, cin, gbinipathname);
}
- sec = (inifile_section_t *) xcalloc(1, sizeof(*sec));
+ sec = (inifile_section_t*) xcalloc(1, sizeof(*sec));
sec->name = xstrdup(cin);
QUEUE_INIT(&sec->entries);
ENQUEUE_TAIL(&inifile->secs, &sec->Q);
inifile->isecs++;
} else {
- char *cx;
- inifile_entry_t *entry;
+ char* cx;
+ inifile_entry_t* entry;
if (sec == NULL) {
fatal("%s: missing section header in '%s'.\n", myname,gbinipathname);
}
- entry = (inifile_entry_t *) xcalloc(1, sizeof(*entry));
+ entry = (inifile_entry_t*) xcalloc(1, sizeof(*entry));
ENQUEUE_TAIL(&sec->entries, &entry->Q);
sec->ientries++;
}
}
-static char *
-inifile_find_value(const inifile_t *inifile, const char *sec_name, const char *key)
+static char*
+inifile_find_value(const inifile_t* inifile, const char* sec_name, const char* key)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
if (inifile == NULL) {
return NULL;
}
QUEUE_FOR_EACH(&inifile->secs, elem, tmp) {
- inifile_section_t *sec = (inifile_section_t *) elem;
+ inifile_section_t* sec = (inifile_section_t*) elem;
if (case_ignore_strcmp(sec->name, sec_name) == 0) {
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&sec->entries, elem, tmp) {
- inifile_entry_t *entry = (inifile_entry_t *) elem;
+ inifile_entry_t* entry = (inifile_entry_t*) elem;
if (case_ignore_strcmp(entry->key, key) == 0) {
return entry->val;
filename == NULL: try to open global gpsbabel.ini
*/
-inifile_t *
-inifile_init(const char *filename, const char *myname)
+inifile_t*
+inifile_init(const char* filename, const char* myname)
{
- inifile_t *result;
- gbfile *fin = NULL;
+ inifile_t* result;
+ gbfile* fin = NULL;
if (filename == NULL) {
fin = open_gpsbabel_inifile();
fin = gbfopen(filename, "rb", myname);
}
- result = (inifile_t *) xcalloc(1, sizeof(*result));
+ result = (inifile_t*) xcalloc(1, sizeof(*result));
QUEUE_INIT(&result->secs);
inifile_load_file(fin, result, myname);
}
void
-inifile_done(inifile_t *inifile)
+inifile_done(inifile_t* inifile)
{
if (inifile == NULL) {
return;
}
if (inifile->isecs > 0) {
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&inifile->secs, elem, tmp) {
- inifile_section_t *sec = (inifile_section_t *) elem;
+ inifile_section_t* sec = (inifile_section_t*) elem;
if (sec->ientries > 0) {
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&sec->entries, elem, tmp) {
- inifile_entry_t *entry = (inifile_entry_t *) elem;
+ inifile_entry_t* entry = (inifile_entry_t*) elem;
if (entry->key) {
xfree(entry->key);
}
int
-inifile_has_section(const inifile_t *inifile, const char *section)
+inifile_has_section(const inifile_t* inifile, const char* section)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(&inifile->secs, elem, tmp) {
- inifile_section_t *sec = (inifile_section_t *) elem;
+ inifile_section_t* sec = (inifile_section_t*) elem;
if (case_ignore_strcmp(sec->name, section) == 0) {
return 1;
}
all key values are valid entities until "inifile_done"
*/
-char *
-inifile_readstr(const inifile_t *inifile, const char *section, const char *key)
+char*
+inifile_readstr(const inifile_t* inifile, const char* section, const char* key)
{
return inifile_find_value(inifile, section, key);
}
*/
int
-inifile_readint(const inifile_t *inifile, const char *section, const char *key, int *value)
+inifile_readint(const inifile_t* inifile, const char* section, const char* key, int* value)
{
- char *str;
+ char* str;
str = inifile_find_value(inifile, section, key);
*/
int
-inifile_readint_def(const inifile_t *inifile, const char *section, const char *key, const int def)
+inifile_readint_def(const inifile_t* inifile, const char* section, const char* key, const int def)
{
int result;
reads inifile filename into memory
myname represents the calling module
*/
-inifile_t * inifile_init(const char *filename, const char *myname);
-void inifile_done(inifile_t *inifile);
+inifile_t* inifile_init(const char* filename, const char* myname);
+void inifile_done(inifile_t* inifile);
-int inifile_has_section(const inifile_t *inifile, const char *section);
+int inifile_has_section(const inifile_t* inifile, const char* section);
/*
inifile_readstr:
returns NULL if not found, otherwise a pointer to the value of key ...
all key values are valid entities until "inifile_done"
*/
-char *inifile_readstr(const inifile_t *inifile, const char *section, const char *key);
+char* inifile_readstr(const inifile_t* inifile, const char* section, const char* key);
/*
inifile_readint:
on success the value is stored into "*value" and "inifile_readint" returns 1,
otherwise inifile_readint returns 0
*/
-int inifile_readint(const inifile_t *inifile, const char *section, const char *key, int *value);
+int inifile_readint(const inifile_t* inifile, const char* section, const char* key, int* value);
/*
inifile_readint_def:
if found inifile_readint_def returns value of key, otherwise a default value "def"
*/
-int inifile_readint_def(const inifile_t *inifile, const char *section, const char *key, const int def);
+int inifile_readint_def(const inifile_t* inifile, const char* section, const char* key, const int def);
#endif
#if FILTERS_ENABLED
#define MYNAME "Interpolate filter"
-static char *opt_interval = NULL;
+static char* opt_interval = NULL;
int interval = 0;
-static char *opt_dist = NULL;
+static char* opt_dist = NULL;
double dist = 0;
-static char *opt_route = NULL;
+static char* opt_route = NULL;
static
arglist_t interpfilt_args[] = {
void
interpfilt_process(void)
{
- queue *backuproute = NULL;
- queue *elem, *tmp, *elem2, *tmp2;
- route_head *rte_new;
+ queue* backuproute = NULL;
+ queue* elem, *tmp, *elem2, *tmp2;
+ route_head* rte_new;
int count = 0;
int first = 0;
double lat1 = 0, lon1 = 0;
route_flush_all_tracks();
}
QUEUE_FOR_EACH(backuproute, elem, tmp) {
- route_head *rte_old = (route_head *)elem;
+ route_head* rte_old = (route_head*)elem;
rte_new = route_head_alloc();
rte_new->rte_name = xstrdup(rte_old->rte_name);
}
first = 1;
QUEUE_FOR_EACH(&rte_old->waypoint_list, elem2, tmp2) {
- waypoint *wpt = (waypoint *)elem2;
+ waypoint* wpt = (waypoint*)elem2;
if (first) {
first = 0;
} else {
for (timen = time1+interval;
timen < wpt->creation_time;
timen += interval) {
- waypoint *wpt_new = waypt_dupe(wpt);
+ waypoint* wpt_new = waypt_dupe(wpt);
wpt_new->creation_time = timen;
if (wpt_new->shortname) {
xfree(wpt_new->shortname);
for (distn = dist;
distn < curdist;
distn += dist) {
- waypoint *wpt_new = waypt_dupe(wpt);
+ waypoint* wpt_new = waypt_dupe(wpt);
wpt_new->creation_time = distn/curdist*
(wpt->creation_time - time1) + time1;
if (wpt_new->shortname) {
}
void
-interpfilt_init(const char *args)
+interpfilt_init(const char* args)
{
- char *fm;
+ char* fm;
if (opt_interval && opt_dist) {
fatal(MYNAME ": Can't interpolate on both time and distance.\n");
} else if (opt_interval && opt_route) {
/* itracku file access */
static void itracku_file_read_data_record(gbfile* fin, itracku_data_record* d);
static gbuint32 itracku_file_read_last_time(gbfile* fin);
-static void itracku_file_read_waypts(gbfile* fin, void (*waypt_add)(waypoint *wpt));
-static void itracku_file_write_waypt(gbfile* fout, const waypoint *wpt);
+static void itracku_file_read_waypts(gbfile* fin, void (*waypt_add)(waypoint* wpt));
+static void itracku_file_write_waypt(gbfile* fout, const waypoint* wpt);
/* itracku device access */
static const char read_update_data_command[] = { 0x60, 0xb5, 0, 0, 0, 0, 0 }; /* command string to start memory dump */
static char* update_data_buffer_write;
static char* update_data_buffer_end;
-static void itracku_device_dump_waypts(void* fd, void (*waypt_add)(waypoint *wpt));
+static void itracku_device_dump_waypts(void* fd, void (*waypt_add)(waypoint* wpt));
static int itracku_device_update_data_init();
static int itracku_device_update_data_read(void* buf, int len);
static void itracku_device_write_string(const char* s);
static const char* itracku_device_read_string();
/* global variables */
-static void *fd; /* serial fd */
+static void* fd; /* serial fd */
static gbfile* fin; /* input file handle */
static gbfile* fout; /* output file handle */
static gbfile* fbackup; /* backup file handle */
static gbuint32 backup_last_creation_time; /* time of last data record in backup file */
static gbuint32 new_waypoint_count; /* count of new waypoints */
-static char *port; /* serial port name */
-static char *backup_file_name; /* "backup" command option */
-static char *only_new; /* "new" command option */
+static char* port; /* serial port name */
+static char* backup_file_name; /* "backup" command option */
+static char* only_new; /* "new" command option */
static void
-dbg(int l, const char *msg, ...)
+dbg(int l, const char* msg, ...)
{
va_list ap;
va_start(ap, msg);
*******************************************************************************/
static void
-itracku_rd_init_common(const char *fname)
+itracku_rd_init_common(const char* fname)
{
new_waypoint_count = 0;
}
static void
-itracku_rd_ser_init(const char *fname)
+itracku_rd_ser_init(const char* fname)
{
#if LATER
int i;
}
static void
-itracku_rd_init(const char *fname)
+itracku_rd_init(const char* fname)
{
fin = gbfopen(fname, "r", MYNAME);
itracku_rd_init_common(fname);
}
static void
-itracku_device_dump_waypts(void* fd, void (*waypt_add)(waypoint *wpt))
+itracku_device_dump_waypts(void* fd, void (*waypt_add)(waypoint* wpt))
{
itracku_data_record d;
}
static void
-itracku_file_read_waypts(gbfile* fin, void (*waypt_add)(waypoint *wpt))
+itracku_file_read_waypts(gbfile* fin, void (*waypt_add)(waypoint* wpt))
{
itracku_data_record d;
}
static void
-itracku_file_write_waypt(gbfile* fout, const waypoint *wpt)
+itracku_file_write_waypt(gbfile* fout, const waypoint* wpt)
{
itracku_data_record d;
to_itracku_data_record(wpt, &d);
}
static void
-itracku_waypt_input(void (*waypt_add)(waypoint *wpt))
+itracku_waypt_input(void (*waypt_add)(waypoint* wpt))
{
if (fd) {
itracku_device_dump_waypts(fd, waypt_add);
static route_head* itracku_read_trk_track;
static void
-itracku_read_trk_waypt_add(waypoint *wpt)
+itracku_read_trk_waypt_add(waypoint* wpt)
{
track_add_wpt(itracku_read_trk_track, wpt);
}
}
static void
-itracku_wr_init(const char *fname)
+itracku_wr_init(const char* fname)
{
fout = gbfopen(fname, "w", MYNAME);
}
}
static void
-itracku_output_waypoint(const waypoint * wp)
+itracku_output_waypoint(const waypoint* wp)
{
itracku_file_write_waypt(fout, wp);
}
}
static void
-itracku_rt_init(const char *fname)
+itracku_rt_init(const char* fname)
{
itracku_rd_ser_init(fname);
itracku_device_write_string("WP AP-Exit");
}
static void
-nmea_set_waypoint_time(waypoint *wpt, struct tm *time, int microseconds)
+nmea_set_waypoint_time(waypoint* wpt, struct tm* time, int microseconds)
{
if (time->tm_year == 0) {
wpt->creation_time = ((((time_t)time->tm_hour * 60) + time->tm_min) * 60) + time->tm_sec;
}
}
-static waypoint *
-gprmc_parse(char *ibuf)
+static waypoint*
+gprmc_parse(char* ibuf)
{
double latdeg, lngdeg;
char lngdir, latdir;
char fix;
unsigned int dmy;
double speed,course;
- waypoint *waypt;
+ waypoint* waypt;
double microseconds;
struct tm tm;
andreas.grimme@gmx.net
*/
-static waypoint *
-itracku_rt_position(posn_status *posn_status)
+static waypoint*
+itracku_rt_position(posn_status* posn_status)
{
char line[1024];
waypoint* wpt;
unsigned long serial_number;
unsigned long unit_id;
unsigned long unit_version;
- char *os_identifier; /* In case the OS has another name for it. */
- char *product_identifier; /* From the hardware itself. */
+ char* os_identifier; /* In case the OS has another name for it. */
+ char* product_identifier; /* From the hardware itself. */
} garmin_unit_info_t;
extern garmin_unit_info_t garmin_unit_info[GUSB_MAX_UNITS];
-int gusb_cmd_send(const garmin_usb_packet *obuf, size_t sz);
-int gusb_cmd_get(garmin_usb_packet *ibuf, size_t sz);
-int gusb_init(const char *portname, gpsdevh **dh);
-int gusb_close(gpsdevh *);
+int gusb_cmd_send(const garmin_usb_packet* obuf, size_t sz);
+int gusb_cmd_get(garmin_usb_packet* ibuf, size_t sz);
+int gusb_init(const char* portname, gpsdevh** dh);
+int gusb_close(gpsdevh*);
/*
* New packet types in USB.
#define ETX 0x03
- extern int32 gps_errno;
- extern int32 gps_warning;
- extern int32 gps_error;
- extern int32 gps_user;
- extern int32 gps_show_bytes;
- extern char gps_categories[16][17];
-
-
- typedef struct GPS_SPacket {
- US type;
- uint32 n;
- UC *data;
- } GPS_OPacket, *GPS_PPacket;
-
- typedef struct GPS_Serial_SPacket {
- UC dle;
- UC type;
- UC n;
- UC *data;
- UC chk;
- UC edle;
- UC etx;
- } GPS_Serial_OPacket, *GPS_Serial_PPacket;
-
- typedef struct GPS_SProduct_Data_Type {
- int16 id;
- int16 version;
- char desc[MAX_GPS_PACKET_SIZE];
- } GPS_OProduct_Data_Type, *GPS_PProduct_Data_Type;
-
-
-
-
- typedef struct GPS_SPvt_Data_Type {
- float alt;
- float epe;
- float eph;
- float epv;
- int16 fix;
- double tow;
- double lat;
- double lon;
- float east;
- float north;
- float up;
- float msl_hght;
- int16 leap_scnds;
- int32 wn_days;
- } GPS_OPvt_Data, *GPS_PPvt_Data;
-
-
-
- typedef struct GPS_STrack {
- double lat; /* Degrees */
- double lon; /* Degrees */
- time_t Time; /* Unix time */
- float alt; /* Altitude */
- float dpth; /* Depth */
- float temperature; /* Temperature. Degrees Celsius. */
- int temperature_populated; /* True if above is valid. */
- unsigned char heartrate; /* Heartrate as in Garmin 301 */
- unsigned char cadence; /* Crank cadence as in Edge 305 */
- unsigned int wsensor_pres:1; /* Wheel sensor present */
- unsigned int tnew:1; /* New track? */
- unsigned int ishdr:1; /* Track header? */
- unsigned int no_latlon:1; /* True if no valid lat/lon found. */
- int32 dspl; /* Display on map? */
- int32 colour; /* Colour */
- float distance; /* distance traveled in meters.*/
- int distance_populated; /* True if above is valid. */
- char trk_ident[256]; /* Track identifier */
- }
- GPS_OTrack, *GPS_PTrack;
-
-
-
- typedef struct GPS_SAlmanac {
- UC svid;
- int16 wn;
- float toa;
- float af0;
- float af1;
- float e;
- float sqrta;
- float m0;
- float w;
- float omg0;
- float odot;
- float i;
- UC hlth;
- } GPS_OAlmanac, *GPS_PAlmanac;
-
-
- typedef struct GPS_SWay {
- char ident[256];
- double lat;
- double lon;
- char cmnt[256];
- float dst;
- int32 smbl;
- int32 dspl;
- char wpt_ident[256];
- char lnk_ident[256];
- UC subclass[18];
- int32 colour;
- char cc[2];
- UC wpt_class;
- UC alt_is_unknown;
- float alt;
- char city[24];
- char state[2];
- char name[30];
- char facility[32];
- char addr[52];
- char cross_road[52];
- int32 attr;
- float dpth;
- int32 idx;
- int32 prot;
- int32 isrte;
- int32 rte_prot;
- UC rte_num;
- char rte_cmnt[20];
- char rte_ident[256];
- int32 islink;
- int32 rte_link_class;
- char rte_link_subclass[18];
- char rte_link_ident[256];
-
- char time_populated; /* 1 if true */
- time_t time; /* Unix time */
- char temperature_populated;
- float temperature; /* Degrees celsius. */
- uint16 category;
-
- } GPS_OWay, *GPS_PWay;
-
- /*
- * Forerunner/Edge Lap data.
- */
- typedef struct GPS_SLap {
- uint32 index; /* unique index in device or -1 */
- time_t start_time;
- uint32 total_time; /* Hundredths of a second */
- float total_distance; /* In meters */
- double begin_lat;
- double begin_lon;
- double end_lat;
- double end_lon;
- int16 calories;
- uint32 track_index; /* ref to track or -1 */
- float max_speed; /* In meters per second */
- unsigned char avg_heart_rate; /* In beats-per-minute, 0 if invalid */
- unsigned char max_heart_rate; /* In beats-per-minute, 0 if invalid */
- unsigned char intensity; /* Same as D1001 */
- unsigned char avg_cadence; /* In revolutions-per-minute, 0xFF if invalid */
- unsigned char trigger_method;
- /*Some D1015 unknown */
- /* unsigned char unk1015_1;
- int16 unk1015_2;
- int16 unk1015_3;
- */
- } GPS_OLap, *GPS_PLap;
-
-
- typedef struct GPS_SCourse {
- uint32 index; /* Unique among courses on device */
- char course_name[16]; /* Null-terminated unique course name */
- uint32 track_index; /* Index of the associated track
+extern int32 gps_errno;
+extern int32 gps_warning;
+extern int32 gps_error;
+extern int32 gps_user;
+extern int32 gps_show_bytes;
+extern char gps_categories[16][17];
+
+
+typedef struct GPS_SPacket {
+ US type;
+ uint32 n;
+ UC* data;
+} GPS_OPacket, *GPS_PPacket;
+
+typedef struct GPS_Serial_SPacket {
+ UC dle;
+ UC type;
+ UC n;
+ UC* data;
+ UC chk;
+ UC edle;
+ UC etx;
+} GPS_Serial_OPacket, *GPS_Serial_PPacket;
+
+typedef struct GPS_SProduct_Data_Type {
+ int16 id;
+ int16 version;
+ char desc[MAX_GPS_PACKET_SIZE];
+} GPS_OProduct_Data_Type, *GPS_PProduct_Data_Type;
+
+
+
+
+typedef struct GPS_SPvt_Data_Type {
+ float alt;
+ float epe;
+ float eph;
+ float epv;
+ int16 fix;
+ double tow;
+ double lat;
+ double lon;
+ float east;
+ float north;
+ float up;
+ float msl_hght;
+ int16 leap_scnds;
+ int32 wn_days;
+} GPS_OPvt_Data, *GPS_PPvt_Data;
+
+
+
+typedef struct GPS_STrack {
+ double lat; /* Degrees */
+ double lon; /* Degrees */
+ time_t Time; /* Unix time */
+ float alt; /* Altitude */
+ float dpth; /* Depth */
+ float temperature; /* Temperature. Degrees Celsius. */
+ int temperature_populated; /* True if above is valid. */
+ unsigned char heartrate; /* Heartrate as in Garmin 301 */
+ unsigned char cadence; /* Crank cadence as in Edge 305 */
+ unsigned int wsensor_pres:1; /* Wheel sensor present */
+ unsigned int tnew:1; /* New track? */
+ unsigned int ishdr:1; /* Track header? */
+ unsigned int no_latlon:1; /* True if no valid lat/lon found. */
+ int32 dspl; /* Display on map? */
+ int32 colour; /* Colour */
+ float distance; /* distance traveled in meters.*/
+ int distance_populated; /* True if above is valid. */
+ char trk_ident[256]; /* Track identifier */
+}
+GPS_OTrack, *GPS_PTrack;
+
+
+
+typedef struct GPS_SAlmanac {
+ UC svid;
+ int16 wn;
+ float toa;
+ float af0;
+ float af1;
+ float e;
+ float sqrta;
+ float m0;
+ float w;
+ float omg0;
+ float odot;
+ float i;
+ UC hlth;
+} GPS_OAlmanac, *GPS_PAlmanac;
+
+
+typedef struct GPS_SWay {
+ char ident[256];
+ double lat;
+ double lon;
+ char cmnt[256];
+ float dst;
+ int32 smbl;
+ int32 dspl;
+ char wpt_ident[256];
+ char lnk_ident[256];
+ UC subclass[18];
+ int32 colour;
+ char cc[2];
+ UC wpt_class;
+ UC alt_is_unknown;
+ float alt;
+ char city[24];
+ char state[2];
+ char name[30];
+ char facility[32];
+ char addr[52];
+ char cross_road[52];
+ int32 attr;
+ float dpth;
+ int32 idx;
+ int32 prot;
+ int32 isrte;
+ int32 rte_prot;
+ UC rte_num;
+ char rte_cmnt[20];
+ char rte_ident[256];
+ int32 islink;
+ int32 rte_link_class;
+ char rte_link_subclass[18];
+ char rte_link_ident[256];
+
+ char time_populated; /* 1 if true */
+ time_t time; /* Unix time */
+ char temperature_populated;
+ float temperature; /* Degrees celsius. */
+ uint16 category;
+
+} GPS_OWay, *GPS_PWay;
+
+/*
+ * Forerunner/Edge Lap data.
+ */
+typedef struct GPS_SLap {
+ uint32 index; /* unique index in device or -1 */
+ time_t start_time;
+ uint32 total_time; /* Hundredths of a second */
+ float total_distance; /* In meters */
+ double begin_lat;
+ double begin_lon;
+ double end_lat;
+ double end_lon;
+ int16 calories;
+ uint32 track_index; /* ref to track or -1 */
+ float max_speed; /* In meters per second */
+ unsigned char avg_heart_rate; /* In beats-per-minute, 0 if invalid */
+ unsigned char max_heart_rate; /* In beats-per-minute, 0 if invalid */
+ unsigned char intensity; /* Same as D1001 */
+ unsigned char avg_cadence; /* In revolutions-per-minute, 0xFF if invalid */
+ unsigned char trigger_method;
+ /*Some D1015 unknown */
+ /* unsigned char unk1015_1;
+ int16 unk1015_2;
+ int16 unk1015_3;
+ */
+} GPS_OLap, *GPS_PLap;
+
+
+typedef struct GPS_SCourse {
+ uint32 index; /* Unique among courses on device */
+ char course_name[16]; /* Null-terminated unique course name */
+ uint32 track_index; /* Index of the associated track
* Must be 0xFFFFFFFF if there is none*/
- } GPS_OCourse, *GPS_PCourse;
-
-
- typedef struct GPS_SCourse_Lap {
- uint32 course_index; /* Index of associated course */
- uint32 lap_index; /* This lap's index in the course */
- uint32 total_time; /* In hundredths of a second */
- float total_dist; /* [m] */
- double begin_lat; /* Starting position of the lap */
- double begin_lon; /* Invalid if lat,lon are 0x7FFFFFFF.*/
- double end_lat; /* Final position of the lap */
- double end_lon; /* Invalid if lat,lon are 0x7FFFFFFF.*/
- UC avg_heart_rate; /* In beats-per-minute, >0 */
- UC max_heart_rate; /* In beats-per-minute, >0 */
- UC intensity; /* 0=standard, active lap.
+} GPS_OCourse, *GPS_PCourse;
+
+
+typedef struct GPS_SCourse_Lap {
+ uint32 course_index; /* Index of associated course */
+ uint32 lap_index; /* This lap's index in the course */
+ uint32 total_time; /* In hundredths of a second */
+ float total_dist; /* [m] */
+ double begin_lat; /* Starting position of the lap */
+ double begin_lon; /* Invalid if lat,lon are 0x7FFFFFFF.*/
+ double end_lat; /* Final position of the lap */
+ double end_lon; /* Invalid if lat,lon are 0x7FFFFFFF.*/
+ UC avg_heart_rate; /* In beats-per-minute, >0 */
+ UC max_heart_rate; /* In beats-per-minute, >0 */
+ UC intensity; /* 0=standard, active lap.
1=rest lap in a workout */
- UC avg_cadence; /* In revolutions-per-minute */
- } GPS_OCourse_Lap, *GPS_PCourse_Lap;
-
- typedef struct GPS_SCourse_Point {
- char name[11]; /* Null-terminated name */
- uint32 course_index; /* Index of associated course */
- time_t track_point_time; /* Time */
- UC point_type; /* generic = 0,
+ UC avg_cadence; /* In revolutions-per-minute */
+} GPS_OCourse_Lap, *GPS_PCourse_Lap;
+
+typedef struct GPS_SCourse_Point {
+ char name[11]; /* Null-terminated name */
+ uint32 course_index; /* Index of associated course */
+ time_t track_point_time; /* Time */
+ UC point_type; /* generic = 0,
* summit = 1,
* valley = 2,
* water = 3,
* first_category = 13,
* hors_category = 14,
* sprint = 15 */
- } GPS_OCourse_Point, *GPS_PCourse_Point;
+} GPS_OCourse_Point, *GPS_PCourse_Point;
- typedef struct GPS_SCourse_Limits {
- uint32 max_courses;
- uint32 max_course_laps;
- uint32 max_course_pnt;
- uint32 max_course_trk_pnt;
- } GPS_OCourse_Limits, *GPS_PCourse_Limits;
+typedef struct GPS_SCourse_Limits {
+ uint32 max_courses;
+ uint32 max_course_laps;
+ uint32 max_course_pnt;
+ uint32 max_course_trk_pnt;
+} GPS_OCourse_Limits, *GPS_PCourse_Limits;
- typedef int (*pcb_fn)(int, struct GPS_SWay **);
+typedef int (*pcb_fn)(int, struct GPS_SWay**);
#include "gpsdevice.h"
#include "gpssend.h"
#include "gpsinput.h"
#include "gpsproj.h"
- extern time_t gps_save_time;
- extern double gps_save_lat;
- extern double gps_save_lon;
- extern int32 gps_save_id;
- extern double gps_save_version;
- extern char gps_save_string[GPS_ARB_LEN];
- extern int gps_is_usb;
-
- extern struct COMMANDDATA COMMAND_ID[2];
- extern struct LINKDATA LINK_ID[3];
- extern struct GPS_MODEL_PROTOCOL GPS_MP[];
-
- extern char *gps_marine_sym[];
- extern char *gps_land_sym[];
- extern char *gps_aviation_sym[];
- extern char *gps_16_sym[];
+extern time_t gps_save_time;
+extern double gps_save_lat;
+extern double gps_save_lon;
+extern int32 gps_save_id;
+extern double gps_save_version;
+extern char gps_save_string[GPS_ARB_LEN];
+extern int gps_is_usb;
+
+extern struct COMMANDDATA COMMAND_ID[2];
+extern struct LINKDATA LINK_ID[3];
+extern struct GPS_MODEL_PROTOCOL GPS_MP[];
+
+extern char* gps_marine_sym[];
+extern char* gps_land_sym[];
+extern char* gps_aviation_sym[];
+extern char* gps_16_sym[];
#endif
#define XMIN(a,b) (a < b? a : b)
-static int32 GPS_A000(const char *port);
+static int32 GPS_A000(const char* port);
static void GPS_A001(GPS_PPacket packet);
-static void GPS_A500_Translate(UC *s, GPS_PAlmanac *alm);
-static void GPS_A500_Encode(UC *s, GPS_PAlmanac alm);
-static void GPS_A300_Translate(UC *s, GPS_PTrack *trk);
-static void GPS_A300_Encode(UC *s, GPS_PTrack trk);
-
-
-static void GPS_D100_Get(GPS_PWay *way, UC *s);
-static void GPS_D101_Get(GPS_PWay *way, UC *s);
-static void GPS_D102_Get(GPS_PWay *way, UC *s);
-static void GPS_D103_Get(GPS_PWay *way, UC *s);
-static void GPS_D104_Get(GPS_PWay *way, UC *s);
-static void GPS_D105_Get(GPS_PWay *way, UC *s);
-static void GPS_D106_Get(GPS_PWay *way, UC *s);
-static void GPS_D107_Get(GPS_PWay *way, UC *s);
-static void GPS_D108_Get(GPS_PWay *way, UC *s);
-static void GPS_D109_Get(GPS_PWay *way, UC *s, int proto);
-static void GPS_D150_Get(GPS_PWay *way, UC *s);
-static void GPS_D151_Get(GPS_PWay *way, UC *s);
-static void GPS_D152_Get(GPS_PWay *way, UC *s);
-static void GPS_D154_Get(GPS_PWay *way, UC *s);
-static void GPS_D155_Get(GPS_PWay *way, UC *s);
-
-static void GPS_D100_Send(UC *data, GPS_PWay way, int32 *len);
-static void GPS_D101_Send(UC *data, GPS_PWay way, int32 *len);
-static void GPS_D102_Send(UC *data, GPS_PWay way, int32 *len);
-static void GPS_D103_Send(UC *data, GPS_PWay way, int32 *len);
-static void GPS_D104_Send(UC *data, GPS_PWay way, int32 *len);
-static void GPS_D105_Send(UC *data, GPS_PWay way, int32 *len);
-static void GPS_D106_Send(UC *data, GPS_PWay way, int32 *len);
-static void GPS_D107_Send(UC *data, GPS_PWay way, int32 *len);
-static void GPS_D108_Send(UC *data, GPS_PWay way, int32 *len);
-static void GPS_D109_Send(UC *data, GPS_PWay way, int32 *len, int proto);
-static void GPS_D150_Send(UC *data, GPS_PWay way, int32 *len);
-static void GPS_D151_Send(UC *data, GPS_PWay way, int32 *len);
-static void GPS_D152_Send(UC *data, GPS_PWay way, int32 *len);
-static void GPS_D154_Send(UC *data, GPS_PWay way, int32 *len);
-static void GPS_D155_Send(UC *data, GPS_PWay way, int32 *len);
-
-static void GPS_D120_Get(int n, char *data);
-
-static void GPS_D200_Get(GPS_PWay *way, UC *s);
-static void GPS_D201_Get(GPS_PWay *way, UC *s);
-static void GPS_D202_Get(GPS_PWay *way, UC *s);
-static void GPS_D210_Get(GPS_PWay *way, UC *s);
-static void GPS_D200_Send(UC *data, GPS_PWay way, int32 *len);
-static void GPS_D201_Send(UC *data, GPS_PWay way, int32 *len);
-static void GPS_D202_Send(UC *data, GPS_PWay way, int32 *len);
-static void GPS_D210_Send(UC *data, GPS_PWay way, int32 *len);
-
-static void GPS_D400_Get(GPS_PWay *way, UC *s);
-static void GPS_D403_Get(GPS_PWay *way, UC *s);
-static void GPS_D450_Get(GPS_PWay *way, UC *s);
-static void GPS_D400_Send(UC *data, GPS_PWay way, int32 *len);
-static void GPS_D403_Send(UC *data, GPS_PWay way, int32 *len);
-static void GPS_D450_Send(UC *data, GPS_PWay way, int32 *len);
-
-static void GPS_D500_Send(UC *data, GPS_PAlmanac alm);
-static void GPS_D501_Send(UC *data, GPS_PAlmanac alm);
-static void GPS_D550_Send(UC *data, GPS_PAlmanac alm);
-static void GPS_D551_Send(UC *data, GPS_PAlmanac alm);
+static void GPS_A500_Translate(UC* s, GPS_PAlmanac* alm);
+static void GPS_A500_Encode(UC* s, GPS_PAlmanac alm);
+static void GPS_A300_Translate(UC* s, GPS_PTrack* trk);
+static void GPS_A300_Encode(UC* s, GPS_PTrack trk);
+
+
+static void GPS_D100_Get(GPS_PWay* way, UC* s);
+static void GPS_D101_Get(GPS_PWay* way, UC* s);
+static void GPS_D102_Get(GPS_PWay* way, UC* s);
+static void GPS_D103_Get(GPS_PWay* way, UC* s);
+static void GPS_D104_Get(GPS_PWay* way, UC* s);
+static void GPS_D105_Get(GPS_PWay* way, UC* s);
+static void GPS_D106_Get(GPS_PWay* way, UC* s);
+static void GPS_D107_Get(GPS_PWay* way, UC* s);
+static void GPS_D108_Get(GPS_PWay* way, UC* s);
+static void GPS_D109_Get(GPS_PWay* way, UC* s, int proto);
+static void GPS_D150_Get(GPS_PWay* way, UC* s);
+static void GPS_D151_Get(GPS_PWay* way, UC* s);
+static void GPS_D152_Get(GPS_PWay* way, UC* s);
+static void GPS_D154_Get(GPS_PWay* way, UC* s);
+static void GPS_D155_Get(GPS_PWay* way, UC* s);
+
+static void GPS_D100_Send(UC* data, GPS_PWay way, int32* len);
+static void GPS_D101_Send(UC* data, GPS_PWay way, int32* len);
+static void GPS_D102_Send(UC* data, GPS_PWay way, int32* len);
+static void GPS_D103_Send(UC* data, GPS_PWay way, int32* len);
+static void GPS_D104_Send(UC* data, GPS_PWay way, int32* len);
+static void GPS_D105_Send(UC* data, GPS_PWay way, int32* len);
+static void GPS_D106_Send(UC* data, GPS_PWay way, int32* len);
+static void GPS_D107_Send(UC* data, GPS_PWay way, int32* len);
+static void GPS_D108_Send(UC* data, GPS_PWay way, int32* len);
+static void GPS_D109_Send(UC* data, GPS_PWay way, int32* len, int proto);
+static void GPS_D150_Send(UC* data, GPS_PWay way, int32* len);
+static void GPS_D151_Send(UC* data, GPS_PWay way, int32* len);
+static void GPS_D152_Send(UC* data, GPS_PWay way, int32* len);
+static void GPS_D154_Send(UC* data, GPS_PWay way, int32* len);
+static void GPS_D155_Send(UC* data, GPS_PWay way, int32* len);
+
+static void GPS_D120_Get(int n, char* data);
+
+static void GPS_D200_Get(GPS_PWay* way, UC* s);
+static void GPS_D201_Get(GPS_PWay* way, UC* s);
+static void GPS_D202_Get(GPS_PWay* way, UC* s);
+static void GPS_D210_Get(GPS_PWay* way, UC* s);
+static void GPS_D200_Send(UC* data, GPS_PWay way, int32* len);
+static void GPS_D201_Send(UC* data, GPS_PWay way, int32* len);
+static void GPS_D202_Send(UC* data, GPS_PWay way, int32* len);
+static void GPS_D210_Send(UC* data, GPS_PWay way, int32* len);
+
+static void GPS_D400_Get(GPS_PWay* way, UC* s);
+static void GPS_D403_Get(GPS_PWay* way, UC* s);
+static void GPS_D450_Get(GPS_PWay* way, UC* s);
+static void GPS_D400_Send(UC* data, GPS_PWay way, int32* len);
+static void GPS_D403_Send(UC* data, GPS_PWay way, int32* len);
+static void GPS_D450_Send(UC* data, GPS_PWay way, int32* len);
+
+static void GPS_D500_Send(UC* data, GPS_PAlmanac alm);
+static void GPS_D501_Send(UC* data, GPS_PAlmanac alm);
+static void GPS_D550_Send(UC* data, GPS_PAlmanac alm);
+static void GPS_D551_Send(UC* data, GPS_PAlmanac alm);
static UC Is_Trackpoint_Invalid(GPS_PTrack trk);
typedef enum { UpperNo = 0, UpperYes = 1 } copycase;
static
-void copy_char_array(UC **dst, char* src, int count, copycase mustupper)
+void copy_char_array(UC** dst, char* src, int count, copycase mustupper)
{
- UC *d = *dst;
+ UC* d = *dst;
int ocount = count;
do {
UC sc = *src++;
**
** @return [int32] 1 if success -ve if error
************************************************************************/
-int32 GPS_Init(const char *port)
+int32 GPS_Init(const char* port)
{
int32 ret;
**
** @return [int32] 1 if success -ve if error
************************************************************************/
-static int32 GPS_A000(const char *port)
+static int32 GPS_A000(const char* port)
{
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
int16 version;
id = GPS_Util_Get_Short(rec->data);
version = GPS_Util_Get_Short((rec->data)+2);
- (void) strcpy(gps_save_string,(char *)rec->data+4);
+ (void) strcpy(gps_save_string,(char*)rec->data+4);
gps_save_id = id;
gps_save_version = (double)((double)version/(double)100.);
{
int32 entries;
int32 i;
- UC *p;
+ UC* p;
US tag;
US data;
US lasta=0;
**
** @return [int32] number of waypoint entries
************************************************************************/
-int32 GPS_A100_Get(const char *port, GPS_PWay **way, int (*cb)(int, GPS_PWay *))
+int32 GPS_A100_Get(const char* port, GPS_PWay** way, int (*cb)(int, GPS_PWay*))
{
static UC data[2];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
int32 n;
n = GPS_Util_Get_Short(rec->data);
if (n)
- if (!((*way)=(GPS_PWay *)malloc(n*sizeof(GPS_PWay)))) {
+ if (!((*way)=(GPS_PWay*)malloc(n*sizeof(GPS_PWay)))) {
GPS_Error("A100_Get: Insufficient memory");
return MEMORY_ERROR;
}
**
** @return [int32] success
************************************************************************/
-int32 GPS_A100_Send(const char *port, GPS_PWay *way, int32 n, int (*cb)(GPS_PWay *))
+int32 GPS_A100_Send(const char* port, GPS_PWay* way, int32 n, int (*cb)(GPS_PWay*))
{
UC data[GPS_ARB_LEN];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
int32 i;
for (i=0; i<n; ++i) {
if (cb) {
- if (cb((GPS_PWay *) way[i])) { /* BUGBUG Wrong level of indirection */
+ if (cb((GPS_PWay*) way[i])) { /* BUGBUG Wrong level of indirection */
break;
}
}
/*
* Get the list of waypoint categories from the receiver.
*/
-int32 GPS_A101_Get(const char *port)
+int32 GPS_A101_Get(const char* port)
{
static UC data[2];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
int32 n;
}
switch (gps_category_type) {
case pD120:
- GPS_D120_Get(i,(char *) rec->data);
+ GPS_D120_Get(i,(char*) rec->data);
break;
}
}
**
** @return [void]
************************************************************************/
-static void GPS_D100_Get(GPS_PWay *way, UC *s)
+static void GPS_D100_Get(GPS_PWay* way, UC* s)
{
- UC *p;
+ UC* p;
int32 i;
p=s;
**
** @return [void]
************************************************************************/
-static void GPS_D101_Get(GPS_PWay *way, UC *s)
+static void GPS_D101_Get(GPS_PWay* way, UC* s)
{
- UC *p;
+ UC* p;
int32 i;
p=s;
**
** @return [void]
************************************************************************/
-static void GPS_D102_Get(GPS_PWay *way, UC *s)
+static void GPS_D102_Get(GPS_PWay* way, UC* s)
{
- UC *p;
+ UC* p;
int32 i;
p=s;
**
** @return [void]
************************************************************************/
-static void GPS_D103_Get(GPS_PWay *way, UC *s)
+static void GPS_D103_Get(GPS_PWay* way, UC* s)
{
- UC *p;
+ UC* p;
int32 i;
p=s;
**
** @return [void]
************************************************************************/
-static void GPS_D104_Get(GPS_PWay *way, UC *s)
+static void GPS_D104_Get(GPS_PWay* way, UC* s)
{
- UC *p;
+ UC* p;
int32 i;
p=s;
**
** @return [void]
************************************************************************/
-static void GPS_D105_Get(GPS_PWay *way, UC *s)
+static void GPS_D105_Get(GPS_PWay* way, UC* s)
{
- UC *p;
- UC *q;
+ UC* p;
+ UC* q;
p=s;
(*way)->smbl = GPS_Util_Get_Short(p);
p+=sizeof(int16);
- q = (UC *)(*way)->wpt_ident;
+ q = (UC*)(*way)->wpt_ident;
while ((*q++ = *p++));
return;
**
** @return [void]
************************************************************************/
-void GPS_D106_Get(GPS_PWay *way, UC *s)
+void GPS_D106_Get(GPS_PWay* way, UC* s)
{
- UC *p;
- UC *q;
+ UC* p;
+ UC* q;
int32 i;
p=s;
(*way)->smbl = GPS_Util_Get_Short(p);
p+=sizeof(int16);
- q = (UC *)(*way)->wpt_ident;
+ q = (UC*)(*way)->wpt_ident;
while ((*q++ = *p++));
- q = (UC *)(*way)->lnk_ident;
+ q = (UC*)(*way)->lnk_ident;
while ((*q++ = *p++));
return;
**
** @return [void]
************************************************************************/
-static void GPS_D107_Get(GPS_PWay *way, UC *s)
+static void GPS_D107_Get(GPS_PWay* way, UC* s)
{
- UC *p;
+ UC* p;
int32 i;
p=s;
**
** @return [void]
************************************************************************/
-static void GPS_D108_Get(GPS_PWay *way, UC *s)
+static void GPS_D108_Get(GPS_PWay* way, UC* s)
{
- UC *p;
- UC *q;
+ UC* p;
+ UC* q;
int32 i;
(*way)->cc[i] = *p++;
}
- q = (UC *)(*way)->ident;
+ q = (UC*)(*way)->ident;
while ((*q++ = *p++));
- q = (UC *)(*way)->cmnt;
+ q = (UC*)(*way)->cmnt;
while ((*q++ = *p++));
- q = (UC *)(*way)->facility;
+ q = (UC*)(*way)->facility;
while ((*q++ = *p++));
- q = (UC *)(*way)->city;
+ q = (UC*)(*way)->city;
while ((*q++ = *p++));
- q = (UC *)(*way)->addr;
+ q = (UC*)(*way)->addr;
while ((*q++ = *p++));
- q = (UC *)(*way)->cross_road;
+ q = (UC*)(*way)->cross_road;
while ((*q++ = *p++));
return;
** of temp, time, and wpt_cat stuck between ete and ident. Rather than
** duplicating the function, we just handle this at runtime.
************************************************************************/
-static void GPS_D109_Get(GPS_PWay *way, UC *s, int protoid)
+static void GPS_D109_Get(GPS_PWay* way, UC* s, int protoid)
{
- UC *p;
- UC *q;
+ UC* p;
+ UC* q;
int32 i;
p += 2;
}
- q = (UC *)(*way)->ident;
+ q = (UC*)(*way)->ident;
while ((*q++ = *p++));
- q = (UC *)(*way)->cmnt;
+ q = (UC*)(*way)->cmnt;
while ((*q++ = *p++));
- q = (UC *)(*way)->facility;
+ q = (UC*)(*way)->facility;
while ((*q++ = *p++));
- q = (UC *)(*way)->city;
+ q = (UC*)(*way)->city;
while ((*q++ = *p++));
- q = (UC *)(*way)->addr;
+ q = (UC*)(*way)->addr;
while ((*q++ = *p++));
- q = (UC *)(*way)->cross_road;
+ q = (UC*)(*way)->cross_road;
while ((*q++ = *p++));
return;
**
** @return [void]
************************************************************************/
-static void GPS_D150_Get(GPS_PWay *way, UC *s)
+static void GPS_D150_Get(GPS_PWay* way, UC* s)
{
- UC *p;
+ UC* p;
int32 i;
p=s;
**
** @return [void]
************************************************************************/
-static void GPS_D151_Get(GPS_PWay *way, UC *s)
+static void GPS_D151_Get(GPS_PWay* way, UC* s)
{
- UC *p;
+ UC* p;
int32 i;
p=s;
**
** @return [void]
************************************************************************/
-static void GPS_D152_Get(GPS_PWay *way, UC *s)
+static void GPS_D152_Get(GPS_PWay* way, UC* s)
{
- UC *p;
+ UC* p;
int32 i;
p=s;
**
** @return [void]
************************************************************************/
-static void GPS_D154_Get(GPS_PWay *way, UC *s)
+static void GPS_D154_Get(GPS_PWay* way, UC* s)
{
- UC *p;
+ UC* p;
int32 i;
p=s;
**
** @return [void]
************************************************************************/
-static void GPS_D155_Get(GPS_PWay *way, UC *s)
+static void GPS_D155_Get(GPS_PWay* way, UC* s)
{
- UC *p;
+ UC* p;
int32 i;
p=s;
* Read descriptor s into category number N;
*/
static
-void GPS_D120_Get(int cat_num, char *s)
+void GPS_D120_Get(int cat_num, char* s)
{
/* we're guaranteed to have no more than 16 chars plus a
* null terminator.
**
** @return [void]
************************************************************************/
-static void GPS_D100_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D100_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
+ UC* p;
p = data;
**
** @return [void]
************************************************************************/
-static void GPS_D101_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D101_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
+ UC* p;
p = data;
**
** @return [void]
************************************************************************/
-static void GPS_D102_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D102_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
+ UC* p;
p = data;
**
** @return [void]
************************************************************************/
-static void GPS_D103_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D103_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
+ UC* p;
p = data;
**
** @return [void]
************************************************************************/
-static void GPS_D104_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D104_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
+ UC* p;
p = data;
**
** @return [void]
************************************************************************/
-static void GPS_D105_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D105_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
- UC *q;
+ UC* p;
+ UC* q;
p = data;
GPS_Util_Put_Short(p, (int16) way->smbl);
p+=sizeof(int16);
- q = (UC *) way->wpt_ident;
+ q = (UC*) way->wpt_ident;
while ((*p++ = *q++));
**
** @return [void]
************************************************************************/
-static void GPS_D106_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D106_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
- UC *q;
+ UC* p;
+ UC* q;
int32 i;
p = data;
GPS_Util_Put_Short(p, (int16) way->smbl);
p+=sizeof(int16);
- q = (UC *) way->wpt_ident;
+ q = (UC*) way->wpt_ident;
while ((*p++ = *q++));
- q = (UC *) way->lnk_ident;
+ q = (UC*) way->lnk_ident;
while ((*p++ = *q++));
*len = p-data;
**
** @return [void]
************************************************************************/
-static void GPS_D107_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D107_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
+ UC* p;
p = data;
**
** @return [void]
************************************************************************/
-static void GPS_D108_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D108_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
- UC *q;
+ UC* p;
+ UC* q;
int32 i;
}
- q = (UC *) way->ident;
+ q = (UC*) way->ident;
i = XMIN(51, sizeof(way->ident));
while ((*p++ = *q++) && i--);
- q = (UC *) way->cmnt;
+ q = (UC*) way->cmnt;
i = XMIN(51, sizeof(way->cmnt));
while ((*p++ = *q++) && i--);
- q = (UC *) way->facility;
+ q = (UC*) way->facility;
i = XMIN(31, sizeof(way->facility));
while ((*p++ = *q++) && i--);
- q = (UC *) way->city;
+ q = (UC*) way->city;
i = XMIN(25, sizeof(way->city));
while ((*p++ = *q++) && i--);
- q = (UC *) way->addr;
+ q = (UC*) way->addr;
i = XMIN(51, sizeof(way->addr));
while ((*p++ = *q++) && i--);
- q = (UC *) way->cross_road;
+ q = (UC*) way->cross_road;
i = XMIN(51, sizeof(way->cross_road));
while ((*p++ = *q++) && i--);
** @return [void]
** D109's and D110's are so simlar, we handle themw with the same code.
************************************************************************/
-static void GPS_D109_Send(UC *data, GPS_PWay way, int32 *len, int protoid)
+static void GPS_D109_Send(UC* data, GPS_PWay way, int32* len, int protoid)
{
- UC *p;
- UC *q;
+ UC* p;
+ UC* q;
int32 i;
p += 2;
}
- q = (UC *) way->ident;
+ q = (UC*) way->ident;
i = XMIN(51, sizeof(way->ident));
while ((*p++ = *q++) && i--);
- q = (UC *) way->cmnt;
+ q = (UC*) way->cmnt;
i = XMIN(51, sizeof(way->cmnt));
while ((*p++ = *q++) && i--);
- q = (UC *) way->facility;
+ q = (UC*) way->facility;
i = XMIN(31, sizeof(way->facility));
while ((*p++ = *q++) && i--);
- q = (UC *) way->city;
+ q = (UC*) way->city;
i = XMIN(25, sizeof(way->city));
while ((*p++ = *q++) && i--);
- q = (UC *) way->addr;
+ q = (UC*) way->addr;
i = XMIN(51, sizeof(way->addr));
while ((*p++ = *q++) && i--);
- q = (UC *) way->cross_road;
+ q = (UC*) way->cross_road;
i = XMIN(51, sizeof(way->cross_road));
while ((*p++ = *q++) && i--);
*len = p-data;
**
** @return [void]
************************************************************************/
-static void GPS_D150_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D150_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
+ UC* p;
int32 i;
p = data;
**
** @return [void]
************************************************************************/
-static void GPS_D151_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D151_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
+ UC* p;
int32 i;
p = data;
**
** @return [void]
************************************************************************/
-static void GPS_D152_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D152_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
+ UC* p;
int32 i;
p = data;
**
** @return [void]
************************************************************************/
-static void GPS_D154_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D154_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
+ UC* p;
int32 i;
p = data;
**
** @return [void]
************************************************************************/
-static void GPS_D155_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D155_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
+ UC* p;
p = data;
**
** @return [int32] number of waypoint entries
************************************************************************/
-int32 GPS_A200_Get(const char *port, GPS_PWay **way)
+int32 GPS_A200_Get(const char* port, GPS_PWay** way)
{
static UC data[2];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
int32 n;
n = GPS_Util_Get_Short(rec->data);
if (n)
- if (!((*way)=(GPS_PWay *)malloc(n*sizeof(GPS_PWay)))) {
+ if (!((*way)=(GPS_PWay*)malloc(n*sizeof(GPS_PWay)))) {
GPS_Error("A200_Get: Insufficient memory");
return MEMORY_ERROR;
}
**
** @return [int32] number of waypoint entries
************************************************************************/
-int32 GPS_A201_Get(const char *port, GPS_PWay **way)
+int32 GPS_A201_Get(const char* port, GPS_PWay** way)
{
static UC data[2];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
int32 n;
n = GPS_Util_Get_Short(rec->data);
if (n)
- if (!((*way)=(GPS_PWay *)malloc(n*sizeof(GPS_PWay)))) {
+ if (!((*way)=(GPS_PWay*)malloc(n*sizeof(GPS_PWay)))) {
GPS_Error("A201_Get: Insufficient memory");
return MEMORY_ERROR;
}
**
** @return [int32] success
************************************************************************/
-int32 GPS_A200_Send(const char *port, GPS_PWay *way, int32 n)
+int32 GPS_A200_Send(const char* port, GPS_PWay* way, int32 n)
{
UC data[GPS_ARB_LEN];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
int32 i;
**
** @return [int32] success
************************************************************************/
-int32 GPS_A201_Send(const char *port, GPS_PWay *way, int32 n)
+int32 GPS_A201_Send(const char* port, GPS_PWay* way, int32 n)
{
UC data[GPS_ARB_LEN];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
int32 i;
**
** @return [void]
************************************************************************/
-static void GPS_D200_Get(GPS_PWay *way, UC *s)
+static void GPS_D200_Get(GPS_PWay* way, UC* s)
{
(*way)->rte_prot = 200;
(*way)->rte_num = *s;
**
** @return [void]
************************************************************************/
-static void GPS_D201_Get(GPS_PWay *way, UC *s)
+static void GPS_D201_Get(GPS_PWay* way, UC* s)
{
- UC *p;
+ UC* p;
int32 i;
p=s;
**
** @return [void]
************************************************************************/
-static void GPS_D202_Get(GPS_PWay *way, UC *s)
+static void GPS_D202_Get(GPS_PWay* way, UC* s)
{
- UC *p;
- UC *q;
+ UC* p;
+ UC* q;
p=s;
(*way)->rte_num = *p++;
#endif
(*way)->isrte = 1;
- q = (UC *)(*way)->rte_ident;
+ q = (UC*)(*way)->rte_ident;
while ((*q++=*p++));
return;
**
** @return [void]
************************************************************************/
-static void GPS_D210_Get(GPS_PWay *way, UC *s)
+static void GPS_D210_Get(GPS_PWay* way, UC* s)
{
- UC *p;
- UC *q;
+ UC* p;
+ UC* q;
int32 i;
p=s;
for (i=0; i<18; ++i) {
(*way)->rte_link_subclass[i] = *p++;
}
- q = (UC *)(*way)->rte_link_ident;
+ q = (UC*)(*way)->rte_link_ident;
while ((*q++=*p++));
return;
**
** @return [void]
************************************************************************/
-static void GPS_D200_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D200_Send(UC* data, GPS_PWay way, int32* len)
{
*data = way->rte_num;
**
** @return [void]
************************************************************************/
-static void GPS_D201_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D201_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
+ UC* p;
p = data;
**
** @return [void]
************************************************************************/
-static void GPS_D202_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D202_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
- UC *q;
+ UC* p;
+ UC* q;
p = data;
- q = (UC *) way->rte_ident;
+ q = (UC*) way->rte_ident;
while ((*p++ = *q++));
**
** @return [void]
************************************************************************/
-static void GPS_D210_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D210_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
- UC *q;
+ UC* p;
+ UC* q;
int32 i;
p = data;
*p++ = way->rte_link_subclass[i];
}
- q = (UC *) way->rte_link_ident;
+ q = (UC*) way->rte_link_ident;
while ((*p++ = *q++));
*len = p-data;
**
** @return [int32] number of track entries
************************************************************************/
-int32 GPS_A300_Get(const char *port, GPS_PTrack **trk, pcb_fn cb)
+int32 GPS_A300_Get(const char* port, GPS_PTrack** trk, pcb_fn cb)
{
static UC data[2];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
int32 n;
n = GPS_Util_Get_Short(rec->data);
if (n)
- if (!((*trk)=(GPS_PTrack *)malloc(n*sizeof(GPS_PTrack)))) {
+ if (!((*trk)=(GPS_PTrack*)malloc(n*sizeof(GPS_PTrack)))) {
GPS_Error("A300_Get: Insufficient memory");
return MEMORY_ERROR;
}
* Hopefully, this won't be needed forever.
*/
int
-drain_run_cmd(gpsdevh *fd)
+drain_run_cmd(gpsdevh* fd)
{
GPS_PPacket tra;
GPS_PPacket rec;
**
** @return [int32] number of track entries
************************************************************************/
-int32 GPS_A301_Get(const char *port, GPS_PTrack **trk, pcb_fn cb, int protoid)
+int32 GPS_A301_Get(const char* port, GPS_PTrack** trk, pcb_fn cb, int protoid)
{
static UC data[2];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
int32 n;
n = GPS_Util_Get_Short(rec->data);
if (n)
- if (!((*trk)=(GPS_PTrack *)malloc(n*sizeof(GPS_PTrack)))) {
+ if (!((*trk)=(GPS_PTrack*)malloc(n*sizeof(GPS_PTrack)))) {
GPS_Error("A301_Get: Insufficient memory");
return MEMORY_ERROR;
}
**
** @return [int32] success
************************************************************************/
-int32 GPS_A300_Send(const char *port, GPS_PTrack *trk, int32 n)
+int32 GPS_A300_Send(const char* port, GPS_PTrack* trk, int32 n)
{
UC data[GPS_ARB_LEN];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
int32 i;
**
** @return [int32] success
************************************************************************/
-int32 GPS_A301_Send(const char *port, GPS_PTrack *trk, int32 n, int protoid,
- gpsdevh *fd)
+int32 GPS_A301_Send(const char* port, GPS_PTrack* trk, int32 n, int protoid,
+ gpsdevh* fd)
{
UC data[GPS_ARB_LEN];
GPS_PPacket tra;
**
** @return [int32] number of entries read
************************************************************************/
-int32 GPS_D300_Get(GPS_PTrack *trk, int32 entries, gpsdevh *fd)
+int32 GPS_D300_Get(GPS_PTrack* trk, int32 entries, gpsdevh* fd)
{
GPS_PPacket tra;
GPS_PPacket rec;
**
** @return [void]
************************************************************************/
-void GPS_D300b_Get(GPS_PTrack *trk, UC *data)
+void GPS_D300b_Get(GPS_PTrack* trk, UC* data)
{
GPS_A300_Translate(data, trk);
**
** @return [void]
************************************************************************/
-void GPS_D301b_Get(GPS_PTrack *trk, UC *data)
+void GPS_D301b_Get(GPS_PTrack* trk, UC* data)
{
- UC *p;
+ UC* p;
uint32 t;
p=data;
**
** @return [void]
************************************************************************/
-void GPS_D302b_Get(GPS_PTrack *trk, UC *data)
+void GPS_D302b_Get(GPS_PTrack* trk, UC* data)
{
- UC *p;
+ UC* p;
uint32 t;
double gps_temp;
**
** @return [void]
************************************************************************/
-void GPS_D303b_Get(GPS_PTrack *trk, UC *data)
+void GPS_D303b_Get(GPS_PTrack* trk, UC* data)
{
- UC *p;
+ UC* p;
uint32 t;
uint32 raw_lat, raw_lon;
int lat_undefined, lon_undefined;
**
** @return [void]
************************************************************************/
-void GPS_D310_Get(GPS_PTrack *trk, UC *s)
+void GPS_D310_Get(GPS_PTrack* trk, UC* s)
{
- UC *p;
- UC *q;
+ UC* p;
+ UC* q;
p=s;
(*trk)->dspl = *p++;
(*trk)->colour = *p++;
- q = (UC *)(*trk)->trk_ident;
+ q = (UC*)(*trk)->trk_ident;
while ((*q++ = *p++));
**
** @return [void]
************************************************************************/
-void GPS_D311_Get(GPS_PTrack *trk, UC *s)
+void GPS_D311_Get(GPS_PTrack* trk, UC* s)
{
- UC *p;
+ UC* p;
short identifier;
p=s;
**
** @return [void]
************************************************************************/
-void GPS_D300_Send(UC *data, GPS_PTrack trk, int32 *len)
+void GPS_D300_Send(UC* data, GPS_PTrack trk, int32* len)
{
- UC *p;
+ UC* p;
p = data;
GPS_A300_Encode(p,trk);
**
** @return [void]
************************************************************************/
-void GPS_D301_Send(UC *data, GPS_PTrack trk, int32 *len, int type)
+void GPS_D301_Send(UC* data, GPS_PTrack trk, int32* len, int type)
{
- UC *p;
+ UC* p;
p = data;
GPS_A300_Encode(p,trk);
**
** @return [void]
************************************************************************/
-void GPS_D303_Send(UC *data, GPS_PTrack trk, int32 *len, int protoid)
+void GPS_D303_Send(UC* data, GPS_PTrack trk, int32* len, int protoid)
{
- UC *p;
+ UC* p;
p = data;
GPS_A300_Encode(p,trk);
**
** @return [void]
************************************************************************/
-void GPS_D311_Send(UC *data, GPS_PTrack trk, int32 *len)
+void GPS_D311_Send(UC* data, GPS_PTrack trk, int32* len)
{
- UC *p;
+ UC* p;
p = data;
GPS_Util_Put_Short(p,strtoul(trk->trk_ident, NULL, 0));
**
** @return [void]
************************************************************************/
-void GPS_D310_Send(UC *data, GPS_PTrack trk, int32 *len)
+void GPS_D310_Send(UC* data, GPS_PTrack trk, int32* len)
{
- UC *p;
- UC *q;
+ UC* p;
+ UC* q;
p = data;
*p++ = trk->dspl;
*p++ = trk->colour;
- q = (UC *) trk->trk_ident;
+ q = (UC*) trk->trk_ident;
while ((*p++ = *q++));
*len = p-data;
**
** @return [void]
************************************************************************/
-static void GPS_A300_Translate(UC *s, GPS_PTrack *trk)
+static void GPS_A300_Translate(UC* s, GPS_PTrack* trk)
{
- UC *p;
+ UC* p;
uint32 t;
p=s;
**
** @return [void]
************************************************************************/
-static void GPS_A300_Encode(UC *s, GPS_PTrack trk)
+static void GPS_A300_Encode(UC* s, GPS_PTrack trk)
{
- UC *p;
+ UC* p;
p=s;
**
** @return [int32] number of waypoint entries
************************************************************************/
-int32 GPS_A400_Get(const char *port, GPS_PWay **way)
+int32 GPS_A400_Get(const char* port, GPS_PWay** way)
{
static UC data[2];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
int32 n;
n = GPS_Util_Get_Short(rec->data);
if (n)
- if (!((*way)=(GPS_PWay *)malloc(n*sizeof(GPS_PWay)))) {
+ if (!((*way)=(GPS_PWay*)malloc(n*sizeof(GPS_PWay)))) {
GPS_Error("A400_Get: Insufficient memory");
return MEMORY_ERROR;
}
**
** @return [int32] success
************************************************************************/
-int32 GPS_A400_Send(const char *port, GPS_PWay *way, int32 n)
+int32 GPS_A400_Send(const char* port, GPS_PWay* way, int32 n)
{
UC data[GPS_ARB_LEN];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
int32 i;
**
** @return [void]
************************************************************************/
-static void GPS_D400_Get(GPS_PWay *way, UC *s)
+static void GPS_D400_Get(GPS_PWay* way, UC* s)
{
- UC *p;
+ UC* p;
int32 i;
p=s;
**
** @return [void]
************************************************************************/
-static void GPS_D403_Get(GPS_PWay *way, UC *s)
+static void GPS_D403_Get(GPS_PWay* way, UC* s)
{
- UC *p;
+ UC* p;
int32 i;
p=s;
**
** @return [void]
************************************************************************/
-static void GPS_D450_Get(GPS_PWay *way, UC *s)
+static void GPS_D450_Get(GPS_PWay* way, UC* s)
{
- UC *p;
+ UC* p;
int32 i;
p=s;
**
** @return [void]
************************************************************************/
-static void GPS_D400_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D400_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
+ UC* p;
int32 i;
p = data;
**
** @return [void]
************************************************************************/
-static void GPS_D403_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D403_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
+ UC* p;
int32 i;
p = data;
**
** @return [void]
************************************************************************/
-static void GPS_D450_Send(UC *data, GPS_PWay way, int32 *len)
+static void GPS_D450_Send(UC* data, GPS_PWay way, int32* len)
{
- UC *p;
+ UC* p;
int32 i;
p = data;
**
** @return [int32] number of almanac entries
************************************************************************/
-int32 GPS_A500_Get(const char *port, GPS_PAlmanac **alm)
+int32 GPS_A500_Get(const char* port, GPS_PAlmanac** alm)
{
static UC data[2];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket trapkt;
GPS_PPacket recpkt;
int32 i, n;
n = GPS_Util_Get_Short(recpkt->data);
if (n)
- if (!((*alm)=(GPS_PAlmanac *)malloc(n*sizeof(GPS_PAlmanac)))) {
+ if (!((*alm)=(GPS_PAlmanac*)malloc(n*sizeof(GPS_PAlmanac)))) {
GPS_Error("A500_Get: Insufficient memory");
return MEMORY_ERROR;
}
**
** @return [int32] success
************************************************************************/
-int32 GPS_A500_Send(const char *port, GPS_PAlmanac *alm, int32 n)
+int32 GPS_A500_Send(const char* port, GPS_PAlmanac* alm, int32 n)
{
UC data[GPS_ARB_LEN];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
int32 i;
**
** @return [void]
************************************************************************/
-static void GPS_A500_Translate(UC *s, GPS_PAlmanac *alm)
+static void GPS_A500_Translate(UC* s, GPS_PAlmanac* alm)
{
- UC *p;
+ UC* p;
p=s;
**
** @return [void]
************************************************************************/
-static void GPS_D500_Send(UC *data, GPS_PAlmanac alm)
+static void GPS_D500_Send(UC* data, GPS_PAlmanac alm)
{
- UC *p;
+ UC* p;
p = data;
GPS_A500_Encode(p,alm);
**
** @return [void]
************************************************************************/
-static void GPS_D501_Send(UC *data, GPS_PAlmanac alm)
+static void GPS_D501_Send(UC* data, GPS_PAlmanac alm)
{
- UC *p;
+ UC* p;
p=data;
p[42] = alm->hlth;
**
** @return [void]
************************************************************************/
-static void GPS_D550_Send(UC *data, GPS_PAlmanac alm)
+static void GPS_D550_Send(UC* data, GPS_PAlmanac alm)
{
- UC *p;
+ UC* p;
p = data;
*p = alm->svid;
**
** @return [void]
************************************************************************/
-static void GPS_D551_Send(UC *data, GPS_PAlmanac alm)
+static void GPS_D551_Send(UC* data, GPS_PAlmanac alm)
{
- UC *p;
+ UC* p;
p = data;
*p = alm->svid;
**
** @return [void]
************************************************************************/
-static void GPS_A500_Encode(UC *s, GPS_PAlmanac alm)
+static void GPS_A500_Encode(UC* s, GPS_PAlmanac alm)
{
- UC *p;
+ UC* p;
p=s;
**
** @return [time_t] GPS time as unix system time, -ve if error
************************************************************************/
-time_t GPS_A600_Get(const char *port)
+time_t GPS_A600_Get(const char* port)
{
static UC data[2];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
time_t ret;
**
** @return [int32] success
************************************************************************/
-int32 GPS_A600_Send(const char *port, time_t Time)
+int32 GPS_A600_Send(const char* port, time_t Time)
{
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
int32 posnsent=0;
************************************************************************/
time_t GPS_D600_Get(GPS_PPacket packet)
{
- UC *p;
+ UC* p;
static struct tm ts;
p = packet->data;
**
** @return [void]
************************************************************************/
-void GPS_D600_Send(GPS_PPacket *packet, time_t Time)
+void GPS_D600_Send(GPS_PPacket* packet, time_t Time)
{
UC data[10];
- UC *p;
- struct tm *ts;
+ UC* p;
+ struct tm* ts;
p = data;
**
** @return [int32] success
************************************************************************/
-int32 GPS_A700_Get(const char *port, double *lat, double *lon)
+int32 GPS_A700_Get(const char* port, double* lat, double* lon)
{
static UC data[2];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
**
** @return [int32] success
************************************************************************/
-int32 GPS_A700_Send(const char *port, double lat, double lon)
+int32 GPS_A700_Send(const char* port, double lat, double lon)
{
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
**
** @return [void]
************************************************************************/
-void GPS_D700_Get(GPS_PPacket packet, double *lat, double *lon)
+void GPS_D700_Get(GPS_PPacket packet, double* lat, double* lon)
{
- UC *p;
+ UC* p;
double t;
p = packet->data;
**
** @return [void]
************************************************************************/
-void GPS_D700_Send(GPS_PPacket *packet, double lat, double lon)
+void GPS_D700_Send(GPS_PPacket* packet, double lat, double lon)
{
UC data[16];
- UC *p;
+ UC* p;
lat = GPS_Math_Deg_To_Rad(lat);
lon = GPS_Math_Deg_To_Rad(lon);
**
** @return [int32] success
************************************************************************/
-int32 GPS_A800_On(const char *port, gpsdevh **fd)
+int32 GPS_A800_On(const char* port, gpsdevh** fd)
{
static UC data[2];
GPS_PPacket tra;
**
** @return [int32] success
************************************************************************/
-int32 GPS_A800_Off(const char *port, gpsdevh **fd)
+int32 GPS_A800_Off(const char* port, gpsdevh** fd)
{
static UC data[2];
GPS_PPacket tra;
**
** @return [int32] success
************************************************************************/
-int32 GPS_A800_Get(gpsdevh **fd, GPS_PPvt_Data *packet)
+int32 GPS_A800_Get(gpsdevh** fd, GPS_PPvt_Data* packet)
{
GPS_PPacket tra;
GPS_PPacket rec;
**
** @return [void]
************************************************************************/
-void GPS_D800_Get(GPS_PPacket packet, GPS_PPvt_Data *pvt)
+void GPS_D800_Get(GPS_PPacket packet, GPS_PPvt_Data* pvt)
{
- UC *p;
+ UC* p;
p = packet->data;
** @return [int32] number of lap entries
************************************************************************/
-int32 GPS_A906_Get(const char *port, GPS_PLap **lap, pcb_fn cb)
+int32 GPS_A906_Get(const char* port, GPS_PLap** lap, pcb_fn cb)
{
static UC data[2];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket trapkt;
GPS_PPacket recpkt;
int32 i, n;
n = GPS_Util_Get_Short(recpkt->data);
if (n)
- if (!((*lap)=(GPS_PLap *)malloc(n*sizeof(GPS_PLap)))) {
+ if (!((*lap)=(GPS_PLap*)malloc(n*sizeof(GPS_PLap)))) {
GPS_Error("A906_Get: Insufficient memory");
return MEMORY_ERROR;
}
**
** @return [void]
************************************************************************/
-void GPS_D1011b_Get(GPS_PLap *Lap, UC *p)
+void GPS_D1011b_Get(GPS_PLap* Lap, UC* p)
{
uint32 t;
************************************************************************/
int32 GPS_A1006_Get
-(const char *port,
- GPS_PCourse **crs,
+(const char* port,
+ GPS_PCourse** crs,
pcb_fn cb)
{
static UC data[2];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket trapkt;
GPS_PPacket recpkt;
int32 i, n;
if (n)
- if (!((*crs)=(GPS_PCourse *)malloc(n*sizeof(GPS_PCourse)))) {
+ if (!((*crs)=(GPS_PCourse*)malloc(n*sizeof(GPS_PCourse)))) {
GPS_Error("A1006_Get: Insufficient memory");
return MEMORY_ERROR;
}
**
** @return [int32] success
************************************************************************/
-int32 GPS_A1006_Send(const char *port,
- GPS_PCourse *crs,
+int32 GPS_A1006_Send(const char* port,
+ GPS_PCourse* crs,
int32 n_crs,
- gpsdevh *fd)
+ gpsdevh* fd)
{
UC data[GPS_ARB_LEN];
GPS_PPacket tra;
**
** @return [void]
************************************************************************/
-void GPS_D1006_Get(GPS_PCourse *crs, UC *p)
+void GPS_D1006_Get(GPS_PCourse* crs, UC* p)
{
int i;
(*crs)->index = GPS_Util_Get_Short(p);
**
** @return [void]
************************************************************************/
-void GPS_D1006_Send(UC *data, GPS_PCourse crs, int32 *len)
+void GPS_D1006_Send(UC* data, GPS_PCourse crs, int32* len)
{
- UC *p;
+ UC* p;
int j;
p = data;
** @return [int32] number of lap entries
************************************************************************/
-int32 GPS_A1007_Get(const char *port, GPS_PCourse_Lap **clp, pcb_fn cb)
+int32 GPS_A1007_Get(const char* port, GPS_PCourse_Lap** clp, pcb_fn cb)
{
static UC data[2];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket trapkt;
GPS_PPacket recpkt;
int32 i, n;
if (n)
- if (!((*clp)=(GPS_PCourse_Lap *)malloc(n*sizeof(GPS_PCourse_Lap)))) {
+ if (!((*clp)=(GPS_PCourse_Lap*)malloc(n*sizeof(GPS_PCourse_Lap)))) {
GPS_Error("A1007_Get: Insufficient memory");
return MEMORY_ERROR;
}
**
** @return [int32] success
************************************************************************/
-int32 GPS_A1007_Send(const char *port,
- GPS_PCourse_Lap *clp,
+int32 GPS_A1007_Send(const char* port,
+ GPS_PCourse_Lap* clp,
int32 n_clp,
- gpsdevh *fd)
+ gpsdevh* fd)
{
UC data[GPS_ARB_LEN];
GPS_PPacket tra;
**
** @return [void]
************************************************************************/
-void GPS_D1007_Get(GPS_PCourse_Lap *clp, UC *p)
+void GPS_D1007_Get(GPS_PCourse_Lap* clp, UC* p)
{
(*clp)->course_index = GPS_Util_Get_Short(p);
p+=sizeof(uint16);
**
** @return [void]
************************************************************************/
-void GPS_D1007_Send(UC *data, GPS_PCourse_Lap clp, int32 *len)
+void GPS_D1007_Send(UC* data, GPS_PCourse_Lap clp, int32* len)
{
- UC *p;
+ UC* p;
p = data;
GPS_Util_Put_Short(p, (US) clp->course_index);
** @return [int32] number of course point entries
************************************************************************/
-int32 GPS_A1008_Get(const char *port, GPS_PCourse_Point **cpt, pcb_fn cb)
+int32 GPS_A1008_Get(const char* port, GPS_PCourse_Point** cpt, pcb_fn cb)
{
static UC data[2];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket trapkt;
GPS_PPacket recpkt;
int32 i, n;
if (n)
- if (!((*cpt)=(GPS_PCourse_Point *)malloc(n*sizeof(GPS_PCourse_Point)))) {
+ if (!((*cpt)=(GPS_PCourse_Point*)malloc(n*sizeof(GPS_PCourse_Point)))) {
GPS_Error("A1008_Get: Insufficient memory");
return MEMORY_ERROR;
}
**
** @return [int32] success
************************************************************************/
-int32 GPS_A1008_Send(const char *port,
- GPS_PCourse_Point *cpt,
+int32 GPS_A1008_Send(const char* port,
+ GPS_PCourse_Point* cpt,
int32 n_cpt,
- gpsdevh *fd)
+ gpsdevh* fd)
{
UC data[GPS_ARB_LEN];
GPS_PPacket tra;
**
** @return [void]
************************************************************************/
-void GPS_D1012_Get(GPS_PCourse_Point *cpt, UC *p)
+void GPS_D1012_Get(GPS_PCourse_Point* cpt, UC* p)
{
int i;
uint32 t;
**
** @return [void]
************************************************************************/
-void GPS_D1012_Send(UC *data, GPS_PCourse_Point cpt, int32 *len)
+void GPS_D1012_Send(UC* data, GPS_PCourse_Point cpt, int32* len)
{
- UC *p;
+ UC* p;
int j;
p = data;
** @return [int32] success
************************************************************************/
-int32 GPS_A1009_Get(const char *port, GPS_PCourse_Limits limits)
+int32 GPS_A1009_Get(const char* port, GPS_PCourse_Limits limits)
{
static UC data[2];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket trapkt;
GPS_PPacket recpkt;
**
** @return [void]
************************************************************************/
-void GPS_D1013_Get(GPS_PCourse_Limits limits, UC *p)
+void GPS_D1013_Get(GPS_PCourse_Limits limits, UC* p)
{
limits->max_courses = GPS_Util_Get_Uint(p);
p+=sizeof(uint32);
* It's unfortunate that these aren't constant and therefore switchable,
* but they really are runtime variable. Sigh.
*/
-const char *
-Get_Pkt_Type(US p, US d0, const char **xinfo)
+const char*
+Get_Pkt_Type(US p, US d0, const char** xinfo)
{
*xinfo = NULL;
#define LT LINK_ID[gps_link_type]
** @param [r] trk [GPS_PTrack **] track
** @param [r] n [int32 *] Number of trackpoints
************************************************************************/
-void GPS_Prepare_Track_For_Device(GPS_PTrack **trk, int32 *n)
+void GPS_Prepare_Track_For_Device(GPS_PTrack** trk, int32* n)
{
int32 i, j;
#include "gps.h"
- int32 GPS_Init(const char *port);
-
- int32 GPS_A100_Get(const char *port, GPS_PWay **way, int (*cb)(int ct, GPS_PWay *));
- int32 GPS_A101_Get(const char *port);
- int32 GPS_A100_Send(const char *port, GPS_PWay *way, int32 n, int (*cb)(GPS_PWay *));
-
- int32 GPS_A200_Get(const char *port, GPS_PWay **way);
- int32 GPS_A201_Get(const char *port, GPS_PWay **way);
- int32 GPS_A200_Send(const char *port, GPS_PWay *way, int32 n);
- int32 GPS_A201_Send(const char *port, GPS_PWay *way, int32 n);
-
- int32 GPS_A300_Get(const char *port, GPS_PTrack **trk, pcb_fn cb);
- int32 GPS_A301_Get(const char *port, GPS_PTrack **trk, pcb_fn cb, int protoid);
- int32 GPS_A300_Send(const char *port, GPS_PTrack *trk, int32 n);
- int32 GPS_A301_Send(const char *port, GPS_PTrack *trk, int32 n, int protoid,
- gpsdevh *fd);
-
- int32 GPS_D300_Get(GPS_PTrack *trk, int32 entries, gpsdevh *h);
- void GPS_D300b_Get(GPS_PTrack *trk, UC *data);
- void GPS_D301b_Get(GPS_PTrack *trk, UC *data);
- void GPS_D302b_Get(GPS_PTrack *trk, UC *data);
- void GPS_D303b_Get(GPS_PTrack *trk, UC *data); /*D304*/
- void GPS_D310_Get(GPS_PTrack *trk, UC *s);
- void GPS_D311_Get(GPS_PTrack *trk, UC *s);
- void GPS_D300_Send(UC *data, GPS_PTrack trk, int32 *len);
- void GPS_D301_Send(UC *data, GPS_PTrack trk, int32 *len, int type);
- void GPS_D303_Send(UC *data, GPS_PTrack trk, int32 *len, int protoid);
- void GPS_D310_Send(UC *data, GPS_PTrack trk, int32 *len);
- void GPS_D311_Send(UC *data, GPS_PTrack trk, int32 *len);
-
- int32 GPS_A400_Get(const char *port, GPS_PWay **way);
- int32 GPS_A400_Send(const char *port, GPS_PWay *way, int32 n);
-
- int32 GPS_A500_Get(const char *port, GPS_PAlmanac **alm);
- int32 GPS_A500_Send(const char *port, GPS_PAlmanac *alm, int32 n);
-
- time_t GPS_A600_Get(const char *port);
+ int32 GPS_Init(const char* port);
+
+ int32 GPS_A100_Get(const char* port, GPS_PWay** way, int (*cb)(int ct, GPS_PWay*));
+ int32 GPS_A101_Get(const char* port);
+ int32 GPS_A100_Send(const char* port, GPS_PWay* way, int32 n, int (*cb)(GPS_PWay*));
+
+ int32 GPS_A200_Get(const char* port, GPS_PWay** way);
+ int32 GPS_A201_Get(const char* port, GPS_PWay** way);
+ int32 GPS_A200_Send(const char* port, GPS_PWay* way, int32 n);
+ int32 GPS_A201_Send(const char* port, GPS_PWay* way, int32 n);
+
+ int32 GPS_A300_Get(const char* port, GPS_PTrack** trk, pcb_fn cb);
+ int32 GPS_A301_Get(const char* port, GPS_PTrack** trk, pcb_fn cb, int protoid);
+ int32 GPS_A300_Send(const char* port, GPS_PTrack* trk, int32 n);
+ int32 GPS_A301_Send(const char* port, GPS_PTrack* trk, int32 n, int protoid,
+ gpsdevh* fd);
+
+ int32 GPS_D300_Get(GPS_PTrack* trk, int32 entries, gpsdevh* h);
+ void GPS_D300b_Get(GPS_PTrack* trk, UC* data);
+ void GPS_D301b_Get(GPS_PTrack* trk, UC* data);
+ void GPS_D302b_Get(GPS_PTrack* trk, UC* data);
+ void GPS_D303b_Get(GPS_PTrack* trk, UC* data); /*D304*/
+ void GPS_D310_Get(GPS_PTrack* trk, UC* s);
+ void GPS_D311_Get(GPS_PTrack* trk, UC* s);
+ void GPS_D300_Send(UC* data, GPS_PTrack trk, int32* len);
+ void GPS_D301_Send(UC* data, GPS_PTrack trk, int32* len, int type);
+ void GPS_D303_Send(UC* data, GPS_PTrack trk, int32* len, int protoid);
+ void GPS_D310_Send(UC* data, GPS_PTrack trk, int32* len);
+ void GPS_D311_Send(UC* data, GPS_PTrack trk, int32* len);
+
+ int32 GPS_A400_Get(const char* port, GPS_PWay** way);
+ int32 GPS_A400_Send(const char* port, GPS_PWay* way, int32 n);
+
+ int32 GPS_A500_Get(const char* port, GPS_PAlmanac** alm);
+ int32 GPS_A500_Send(const char* port, GPS_PAlmanac* alm, int32 n);
+
+ time_t GPS_A600_Get(const char* port);
time_t GPS_D600_Get(GPS_PPacket packet);
- int32 GPS_A600_Send(const char *port, time_t Time);
- void GPS_D600_Send(GPS_PPacket *packet, time_t Time);
-
- int32 GPS_A700_Get(const char *port, double *lat, double *lon);
- int32 GPS_A700_Send(const char *port, double lat, double lon);
- void GPS_D700_Get(GPS_PPacket packet, double *lat, double *lon);
- void GPS_D700_Send(GPS_PPacket *packet, double lat, double lon);
-
- int32 GPS_A800_On(const char *port, gpsdevh **fd);
- int32 GPS_A800_Off(const char *port, gpsdevh **fd);
- int32 GPS_A800_Get(gpsdevh **fd, GPS_PPvt_Data *packet);
- void GPS_D800_Get(GPS_PPacket packet, GPS_PPvt_Data *pvt);
-
- int32 GPS_A906_Get(const char *port, GPS_PLap **lap, pcb_fn cb);
- void GPS_D1011b_Get(GPS_PLap *Lap,UC *data); /*D906 D1001 D1015*/
-
- int32 GPS_A1006_Get(const char *port, GPS_PCourse **crs, pcb_fn cb);
- int32 GPS_A1006_Send(const char *port, GPS_PCourse *crs, int32 n_crs,
- gpsdevh *fd);
- void GPS_D1006_Get(GPS_PCourse *crs, UC *p);
- void GPS_D1006_Send(UC *data, GPS_PCourse crs, int32 *len);
-
- int32 GPS_A1007_Get(const char *port, GPS_PCourse_Lap **clp, pcb_fn cb);
- int32 GPS_A1007_Send(const char *port, GPS_PCourse_Lap *clp, int32 n_clp,
- gpsdevh *fd);
- void GPS_D1007_Get(GPS_PCourse_Lap *clp, UC *p);
- void GPS_D1007_Send(UC *data, GPS_PCourse_Lap clp, int32 *len);
-
- int32 GPS_A1008_Get(const char *port, GPS_PCourse_Point **cpt, pcb_fn cb);
- int32 GPS_A1008_Send(const char *port, GPS_PCourse_Point *cpt, int32 n_cpt,
- gpsdevh *fd);
- void GPS_D1012_Get(GPS_PCourse_Point *cpt, UC *p);
- void GPS_D1012_Send(UC *data, GPS_PCourse_Point cpt, int32 *len);
-
- int32 GPS_A1009_Get(const char *port, GPS_PCourse_Limits limits);
- void GPS_D1013_Get(GPS_PCourse_Limits limits, UC *p);
+ int32 GPS_A600_Send(const char* port, time_t Time);
+ void GPS_D600_Send(GPS_PPacket* packet, time_t Time);
+
+ int32 GPS_A700_Get(const char* port, double* lat, double* lon);
+ int32 GPS_A700_Send(const char* port, double lat, double lon);
+ void GPS_D700_Get(GPS_PPacket packet, double* lat, double* lon);
+ void GPS_D700_Send(GPS_PPacket* packet, double lat, double lon);
+
+ int32 GPS_A800_On(const char* port, gpsdevh** fd);
+ int32 GPS_A800_Off(const char* port, gpsdevh** fd);
+ int32 GPS_A800_Get(gpsdevh** fd, GPS_PPvt_Data* packet);
+ void GPS_D800_Get(GPS_PPacket packet, GPS_PPvt_Data* pvt);
+
+ int32 GPS_A906_Get(const char* port, GPS_PLap** lap, pcb_fn cb);
+ void GPS_D1011b_Get(GPS_PLap* Lap,UC* data); /*D906 D1001 D1015*/
+
+ int32 GPS_A1006_Get(const char* port, GPS_PCourse** crs, pcb_fn cb);
+ int32 GPS_A1006_Send(const char* port, GPS_PCourse* crs, int32 n_crs,
+ gpsdevh* fd);
+ void GPS_D1006_Get(GPS_PCourse* crs, UC* p);
+ void GPS_D1006_Send(UC* data, GPS_PCourse crs, int32* len);
+
+ int32 GPS_A1007_Get(const char* port, GPS_PCourse_Lap** clp, pcb_fn cb);
+ int32 GPS_A1007_Send(const char* port, GPS_PCourse_Lap* clp, int32 n_clp,
+ gpsdevh* fd);
+ void GPS_D1007_Get(GPS_PCourse_Lap* clp, UC* p);
+ void GPS_D1007_Send(UC* data, GPS_PCourse_Lap clp, int32* len);
+
+ int32 GPS_A1008_Get(const char* port, GPS_PCourse_Point** cpt, pcb_fn cb);
+ int32 GPS_A1008_Send(const char* port, GPS_PCourse_Point* cpt, int32 n_cpt,
+ gpsdevh* fd);
+ void GPS_D1012_Get(GPS_PCourse_Point* cpt, UC* p);
+ void GPS_D1012_Send(UC* data, GPS_PCourse_Point cpt, int32* len);
+
+ int32 GPS_A1009_Get(const char* port, GPS_PCourse_Limits limits);
+ void GPS_D1013_Get(GPS_PCourse_Limits limits, UC* p);
/* Unhandled documented protocols, as of:
Garmin Device Interface Specification, May 19, 2006, Drawing Number: 001-00063-00 Rev. C
Capability A1013: D1014
*/
- const char * Get_Pkt_Type(US p, US d0, const char **xinfo);
+ const char* Get_Pkt_Type(US p, US d0, const char** xinfo);
- void GPS_Prepare_Track_For_Device(GPS_PTrack **trk, int32 *n);
+ void GPS_Prepare_Track_For_Device(GPS_PTrack** trk, int32* n);
#endif
** @return [int32] success
************************************************************************/
-int32 GPS_Command_Off(const char *port)
+int32 GPS_Command_Off(const char* port)
{
static UC data[2];
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_PPacket tra;
GPS_PPacket rec;
** @return [int32] number of waypoint entries
************************************************************************/
-int32 GPS_Command_Get_Waypoint(const char *port, GPS_PWay **way, pcb_fn cb)
+int32 GPS_Command_Get_Waypoint(const char* port, GPS_PWay** way, pcb_fn cb)
{
int32 ret=0;
** @return [int32] success
************************************************************************/
-int32 GPS_Command_Send_Waypoint(const char *port, GPS_PWay *way, int32 n, int (*cb)(struct GPS_SWay **))
+int32 GPS_Command_Send_Waypoint(const char* port, GPS_PWay* way, int32 n, int (*cb)(struct GPS_SWay**))
{
int32 ret=0;
** @return [int32] number of waypoint entries
************************************************************************/
-int32 GPS_Command_Get_Route(const char *port, GPS_PWay **way)
+int32 GPS_Command_Get_Route(const char* port, GPS_PWay** way)
{
int32 ret=0;
** @return [int32] success
************************************************************************/
-int32 GPS_Command_Send_Route(const char *port, GPS_PWay *way, int32 n)
+int32 GPS_Command_Send_Route(const char* port, GPS_PWay* way, int32 n)
{
int32 ret=0;
** @return [int32] number of track entries
************************************************************************/
-int32 GPS_Command_Get_Track(const char *port, GPS_PTrack **trk, pcb_fn cb)
+int32 GPS_Command_Get_Track(const char* port, GPS_PTrack** trk, pcb_fn cb)
{
int32 ret=0;
** @return [int32] success
************************************************************************/
-int32 GPS_Command_Send_Track(const char *port, GPS_PTrack *trk, int32 n, int eraset)
+int32 GPS_Command_Send_Track(const char* port, GPS_PTrack* trk, int32 n, int eraset)
{
int32 ret=0;
** @return [int32] number of waypoint entries
************************************************************************/
-int32 GPS_Command_Get_Proximity(const char *port, GPS_PWay **way)
+int32 GPS_Command_Get_Proximity(const char* port, GPS_PWay** way)
{
int32 ret=0;
** @return [int32] success
************************************************************************/
-int32 GPS_Command_Send_Proximity(const char *port, GPS_PWay *way, int32 n)
+int32 GPS_Command_Send_Proximity(const char* port, GPS_PWay* way, int32 n)
{
int32 ret=0;
** @return [int32] number of almanac entries
************************************************************************/
-int32 GPS_Command_Get_Almanac(const char *port, GPS_PAlmanac **alm)
+int32 GPS_Command_Get_Almanac(const char* port, GPS_PAlmanac** alm)
{
int32 ret=0;
** @return [int32] success
************************************************************************/
-int32 GPS_Command_Send_Almanac(const char *port, GPS_PAlmanac *alm, int32 n)
+int32 GPS_Command_Send_Almanac(const char* port, GPS_PAlmanac* alm, int32 n)
{
int32 ret=0;
** @return [time_t] unix-style time
************************************************************************/
-time_t GPS_Command_Get_Time(const char *port)
+time_t GPS_Command_Get_Time(const char* port)
{
time_t ret=0;
** @return [int32] true if OK
************************************************************************/
-int32 GPS_Command_Send_Time(const char *port, time_t Time)
+int32 GPS_Command_Send_Time(const char* port, time_t Time)
{
time_t ret=0;
** @return [int32] success
************************************************************************/
-int32 GPS_Command_Get_Position(const char *port, double *lat, double *lon)
+int32 GPS_Command_Get_Position(const char* port, double* lat, double* lon)
{
int32 ret=0;
** @return [int32] success
************************************************************************/
-int32 GPS_Command_Send_Position(const char *port, double lat, double lon)
+int32 GPS_Command_Send_Position(const char* port, double lat, double lon)
{
int32 ret=0;
** @return [int32] success if supported and GPS starts sending
************************************************************************/
-int32 GPS_Command_Pvt_On(const char *port, gpsdevh **fd)
+int32 GPS_Command_Pvt_On(const char* port, gpsdevh** fd)
{
int32 ret=0;
** @return [int32] success
************************************************************************/
-int32 GPS_Command_Pvt_Off(const char *port, gpsdevh **fd)
+int32 GPS_Command_Pvt_Off(const char* port, gpsdevh** fd)
{
int32 ret=0;
** @return [int32] success
************************************************************************/
-int32 GPS_Command_Pvt_Get(gpsdevh **fd, GPS_PPvt_Data *pvt)
+int32 GPS_Command_Pvt_Get(gpsdevh** fd, GPS_PPvt_Data* pvt)
{
int32 ret=0;
** @return [int32] number of lap entries
************************************************************************/
-int32 GPS_Command_Get_Lap(const char *port, GPS_PLap **lap, pcb_fn cb)
+int32 GPS_Command_Get_Lap(const char* port, GPS_PLap** lap, pcb_fn cb)
{
int32 ret=0;
** @return [int32] number of course entries
************************************************************************/
int32 GPS_Command_Get_Course
-(const char *port,
- GPS_PCourse **crs,
- GPS_PCourse_Lap **clp,
- GPS_PTrack **trk,
- GPS_PCourse_Point **cpt,
- int32 *n_clp,
- int32 *n_trk,
- int32 *n_cpt,
+(const char* port,
+ GPS_PCourse** crs,
+ GPS_PCourse_Lap** clp,
+ GPS_PTrack** trk,
+ GPS_PCourse_Point** cpt,
+ int32* n_clp,
+ int32* n_trk,
+ int32* n_cpt,
pcb_fn cb)
{
int32 ret=0;
** @return [int32] Success
************************************************************************/
int32 GPS_Command_Send_Course
-(const char *port,
- GPS_PCourse *crs,
- GPS_PCourse_Lap *clp,
- GPS_PTrack *trk,
- GPS_PCourse_Point *cpt,
+(const char* port,
+ GPS_PCourse* crs,
+ GPS_PCourse_Lap* clp,
+ GPS_PTrack* trk,
+ GPS_PCourse_Point* cpt,
int32 n_crs,
int32 n_clp,
int32 n_trk,
int32 n_cpt)
{
- gpsdevh *fd;
+ gpsdevh* fd;
GPS_OCourse_Limits limits;
int32 ret;
int32 ret_crs=0;
**
** @return [uint32] course index
************************************************************************/
-static uint32 Unique_Course_Index(GPS_PCourse *crs, int n_crs)
+static uint32 Unique_Course_Index(GPS_PCourse* crs, int n_crs)
{
uint32 idx;
int i;
**
** @return [uint32] track index
************************************************************************/
-static uint32 Unique_Track_Index(GPS_PCourse *crs, int n_crs)
+static uint32 Unique_Track_Index(GPS_PCourse* crs, int n_crs)
{
uint32 idx;
int i;
** @return [void]
************************************************************************/
static void
-Calculate_Course_Lap_Data(GPS_PCourse_Lap clp, GPS_PTrack *ctk,
+Calculate_Course_Lap_Data(GPS_PCourse_Lap clp, GPS_PTrack* ctk,
int ctk_start, int ctk_end)
{
int i;
** @return [void]
************************************************************************/
static void
-Course_Garbage_Collect(GPS_PCourse *crs, int *n_crs,
- GPS_PCourse_Lap *clp, int *n_clp,
- GPS_PTrack *ctk, int *n_ctk,
- GPS_PCourse_Point *cpt, int *n_cpt)
+Course_Garbage_Collect(GPS_PCourse* crs, int* n_crs,
+ GPS_PCourse_Lap* clp, int* n_clp,
+ GPS_PTrack* ctk, int* n_ctk,
+ GPS_PCourse_Point* cpt, int* n_cpt)
{
int i, j;
** @return [int32] success
************************************************************************/
-int32 GPS_Command_Send_Track_As_Course(const char *port, GPS_PTrack *trk, int32 n_trk,
- GPS_PWay *wpt, int32 n_wpt, int eraset)
+int32 GPS_Command_Send_Track_As_Course(const char* port, GPS_PTrack* trk, int32 n_trk,
+ GPS_PWay* wpt, int32 n_wpt, int eraset)
{
- GPS_PCourse *crs = NULL;
- GPS_PCourse_Lap *clp = NULL;
- GPS_PTrack *ctk = NULL;
- GPS_PCourse_Point *cpt = NULL;
+ GPS_PCourse* crs = NULL;
+ GPS_PCourse_Lap* clp = NULL;
+ GPS_PTrack* ctk = NULL;
+ GPS_PCourse_Point* cpt = NULL;
int n_crs, n_clp=0, n_ctk=0, n_cpt=0;
int i, j, trk_end, new_crs, first_new_ctk;
int32 ret;
}
/*Stubs for unimplemented stuff*/
-int32 GPS_Command_Get_Workout(const char *port, void **lap, int (*cb)(int, struct GPS_SWay **))
+int32 GPS_Command_Get_Workout(const char* port, void** lap, int (*cb)(int, struct GPS_SWay**))
{
return 0;
}
-int32 GPS_Command_Get_Fitness_User_Profile(const char *port, void **lap, int (*cb)(int, struct GPS_SWay **))
+int32 GPS_Command_Get_Fitness_User_Profile(const char* port, void** lap, int (*cb)(int, struct GPS_SWay**))
{
return 0;
}
-int32 GPS_Command_Get_Workout_Limits(const char *port, void **lap, int (*cb)(int, struct GPS_SWay **))
+int32 GPS_Command_Get_Workout_Limits(const char* port, void** lap, int (*cb)(int, struct GPS_SWay**))
{
return 0;
}
-int32 GPS_Command_Get_Course_Limits(const char *port, void **lap, int (*cb)(int, struct GPS_SWay **))
+int32 GPS_Command_Get_Course_Limits(const char* port, void** lap, int (*cb)(int, struct GPS_SWay**))
{
return 0;
}
#include "gps.h"
#include <time.h>
- int32 GPS_Command_Off(const char *port);
+ int32 GPS_Command_Off(const char* port);
- time_t GPS_Command_Get_Time(const char *port);
- int32 GPS_Command_Send_Time(const char *port, time_t Time);
+ time_t GPS_Command_Get_Time(const char* port);
+ int32 GPS_Command_Send_Time(const char* port, time_t Time);
- int32 GPS_Command_Get_Position(const char *port, double *lat, double *lon);
- int32 GPS_Command_Send_Position(const char *port, double lat, double lon);
+ int32 GPS_Command_Get_Position(const char* port, double* lat, double* lon);
+ int32 GPS_Command_Send_Position(const char* port, double lat, double lon);
- int32 GPS_Command_Pvt_On(const char *port, gpsdevh **fd);
- int32 GPS_Command_Pvt_Off(const char *port, gpsdevh **fd);
- int32 GPS_Command_Pvt_Get(gpsdevh **fd, GPS_PPvt_Data *pvt);
+ int32 GPS_Command_Pvt_On(const char* port, gpsdevh** fd);
+ int32 GPS_Command_Pvt_Off(const char* port, gpsdevh** fd);
+ int32 GPS_Command_Pvt_Get(gpsdevh** fd, GPS_PPvt_Data* pvt);
- int32 GPS_Command_Get_Almanac(const char *port, GPS_PAlmanac **alm);
- int32 GPS_Command_Send_Almanac(const char *port, GPS_PAlmanac *alm, int32 n);
+ int32 GPS_Command_Get_Almanac(const char* port, GPS_PAlmanac** alm);
+ int32 GPS_Command_Send_Almanac(const char* port, GPS_PAlmanac* alm, int32 n);
- int32 GPS_Command_Get_Track(const char *port, GPS_PTrack **trk, int (*cb)(int, struct GPS_SWay **));
- int32 GPS_Command_Send_Track(const char *port, GPS_PTrack *trk, int32 n, int eraset);
+ int32 GPS_Command_Get_Track(const char* port, GPS_PTrack** trk, int (*cb)(int, struct GPS_SWay**));
+ int32 GPS_Command_Send_Track(const char* port, GPS_PTrack* trk, int32 n, int eraset);
- int32 GPS_Command_Get_Waypoint(const char *port, GPS_PWay **way,int (*cb)(int, struct GPS_SWay **));
- int32 GPS_Command_Send_Waypoint(const char *port, GPS_PWay *way, int32 n, int (*cb)(struct GPS_SWay **));
+ int32 GPS_Command_Get_Waypoint(const char* port, GPS_PWay** way,int (*cb)(int, struct GPS_SWay**));
+ int32 GPS_Command_Send_Waypoint(const char* port, GPS_PWay* way, int32 n, int (*cb)(struct GPS_SWay**));
- int32 GPS_Command_Get_Proximity(const char *port, GPS_PWay **way);
- int32 GPS_Command_Send_Proximity(const char *port, GPS_PWay *way, int32 n);
+ int32 GPS_Command_Get_Proximity(const char* port, GPS_PWay** way);
+ int32 GPS_Command_Send_Proximity(const char* port, GPS_PWay* way, int32 n);
- int32 GPS_Command_Get_Route(const char *port, GPS_PWay **way);
- int32 GPS_Command_Send_Route(const char *port, GPS_PWay *way, int32 n);
+ int32 GPS_Command_Get_Route(const char* port, GPS_PWay** way);
+ int32 GPS_Command_Send_Route(const char* port, GPS_PWay* way, int32 n);
- int32 GPS_Command_Get_Lap(const char *port, GPS_PLap **lap, int (*cb)(int, struct GPS_SWay **));
+ int32 GPS_Command_Get_Lap(const char* port, GPS_PLap** lap, int (*cb)(int, struct GPS_SWay**));
- int32 GPS_Command_Send_Course(const char *port, GPS_PCourse *crs, GPS_PCourse_Lap *clp,
- GPS_PTrack *trk, GPS_PCourse_Point *cpt,
+ int32 GPS_Command_Send_Course(const char* port, GPS_PCourse* crs, GPS_PCourse_Lap* clp,
+ GPS_PTrack* trk, GPS_PCourse_Point* cpt,
int32 n_crs, int32 n_clp, int32 n_trk, int32 n_cpt);
- int32 GPS_Command_Send_Track_As_Course(const char *port, GPS_PTrack *trk, int32 n_trk,
- GPS_PWay *wpt, int32 n_wpt, int eraset);
+ int32 GPS_Command_Send_Track_As_Course(const char* port, GPS_PTrack* trk, int32 n_trk,
+ GPS_PWay* wpt, int32 n_wpt, int eraset);
- int32 GPS_Command_Get_Workout(const char *port, void **lap, int (*cb)(int, struct GPS_SWay **));
- int32 GPS_Command_Get_Fitness_User_Profile(const char *port, void **lap, int (*cb)(int, struct GPS_SWay **));
- int32 GPS_Command_Get_Workout_Limits(const char *port, void **lap, int (*cb)(int, struct GPS_SWay **));
- int32 GPS_Command_Get_Course_Limits(const char *port, void **lap, int (*cb)(int, struct GPS_SWay **));
+ int32 GPS_Command_Get_Workout(const char* port, void** lap, int (*cb)(int, struct GPS_SWay**));
+ int32 GPS_Command_Get_Fitness_User_Profile(const char* port, void** lap, int (*cb)(int, struct GPS_SWay**));
+ int32 GPS_Command_Get_Workout_Limits(const char* port, void** lap, int (*cb)(int, struct GPS_SWay**));
+ int32 GPS_Command_Get_Course_Limits(const char* port, void** lap, int (*cb)(int, struct GPS_SWay**));
#endif
#ifdef __cplusplus
typedef struct GPS_SEllipse {
- char *name;
+ char* name;
double a;
double invf;
} GPS_OEllipse, *GPS_PEllipse;
typedef struct GPS_SDatum {
- char *name;
+ char* name;
int ellipse;
double dx;
double dy;
typedef struct GPS_SDatum_Alias {
- char *alias;
+ char* alias;
const int datum;
} GPS_ODatum_Alias, *GPS_PDatum_Alias;
/* UK Ordnance Survey Nation Grid Map Codes */
- static char *UKNG[]= {
+ static char* UKNG[]= {
"SV","SW","SX","SY","SZ","TV","TW","SQ","SR","SS","ST","SU","TQ","TR",
"SL","SM","SN","SO","SP","TL","TM","SF","SG","SH","SJ","SK","TF","TG",
"SA","SB","SC","SD","SE","TA","TB","NV","NW","NX","NY","NZ","OV","OW",
extern gps_device_ops gps_serial_ops;
extern gps_device_ops gps_usb_ops;
-gps_device_ops *ops = NULL;
+gps_device_ops* ops = NULL;
-int32 GPS_Device_On(const char *port, gpsdevh **fd)
+int32 GPS_Device_On(const char* port, gpsdevh** fd)
{
gps_is_usb = (0 == case_ignore_strncmp(port, "usb:", 4));
return (ops->Device_On)(port, fd);
}
-int32 GPS_Device_Off(gpsdevh * fd)
+int32 GPS_Device_Off(gpsdevh* fd)
{
return (ops->Device_Off)(fd);
}
-int32 GPS_Device_Wait(gpsdevh * fd)
+int32 GPS_Device_Wait(gpsdevh* fd)
{
return (ops->Device_Wait)(fd);
}
-int32 GPS_Device_Chars_Ready(gpsdevh * fd)
+int32 GPS_Device_Chars_Ready(gpsdevh* fd)
{
return (ops->Device_Chars_Ready)(fd);
}
-int32 GPS_Device_Flush(gpsdevh * fd)
+int32 GPS_Device_Flush(gpsdevh* fd)
{
return (ops->Device_Flush)(fd);
}
-int32 GPS_Write_Packet(gpsdevh * fd, GPS_PPacket packet)
+int32 GPS_Write_Packet(gpsdevh* fd, GPS_PPacket packet)
{
return (ops->Write_Packet)(fd, packet);
}
-int32 GPS_Packet_Read(gpsdevh * fd, GPS_PPacket *packet)
+int32 GPS_Packet_Read(gpsdevh* fd, GPS_PPacket* packet)
{
return (ops->Read_Packet)(fd, packet);
}
-int32 GPS_Send_Ack(gpsdevh * fd, GPS_PPacket *tra, GPS_PPacket *rec)
+int32 GPS_Send_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec)
{
return (ops->Send_Ack)(fd, tra, rec);
}
-int32 GPS_Get_Ack(gpsdevh * fd, GPS_PPacket *tra, GPS_PPacket *rec)
+int32 GPS_Get_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec)
{
return (ops->Get_Ack)(fd, tra, rec);
}
-void GPS_Make_Packet(GPS_PPacket *packet, US type, UC *data, uint32 n)
+void GPS_Make_Packet(GPS_PPacket* packet, US type, UC* data, uint32 n)
{
(*packet)->type = type;
memcpy((*packet)->data, data, n);
#define usecDELAY 180000 /* Microseconds before GPS sends A001 */
- int32 GPS_Device_Chars_Ready(gpsdevh *fd);
- int32 GPS_Device_On(const char *port, gpsdevh **fd);
- int32 GPS_Device_Off(gpsdevh *fd);
- int32 GPS_Device_Wait(gpsdevh * fd);
- int32 GPS_Device_Flush(gpsdevh * fd);
- int32 GPS_Device_Read(int32 ignored, void *ibuf, int size);
- int32 GPS_Device_Write(int32 ignored, const void *obuf, int size);
- void GPS_Device_Error(char *hdr, ...);
- int32 GPS_Write_Packet(gpsdevh *fd, GPS_PPacket packet);
- int32 GPS_Send_Ack(gpsdevh *fd, GPS_PPacket *tra, GPS_PPacket *rec);
- int32 GPS_Packet_Read(gpsdevh *fd, GPS_PPacket *packet);
- int32 GPS_Get_Ack(gpsdevh *fd, GPS_PPacket *tra, GPS_PPacket *rec);
+ int32 GPS_Device_Chars_Ready(gpsdevh* fd);
+ int32 GPS_Device_On(const char* port, gpsdevh** fd);
+ int32 GPS_Device_Off(gpsdevh* fd);
+ int32 GPS_Device_Wait(gpsdevh* fd);
+ int32 GPS_Device_Flush(gpsdevh* fd);
+ int32 GPS_Device_Read(int32 ignored, void* ibuf, int size);
+ int32 GPS_Device_Write(int32 ignored, const void* obuf, int size);
+ void GPS_Device_Error(char* hdr, ...);
+ int32 GPS_Write_Packet(gpsdevh* fd, GPS_PPacket packet);
+ int32 GPS_Send_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec);
+ int32 GPS_Packet_Read(gpsdevh* fd, GPS_PPacket* packet);
+ int32 GPS_Get_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec);
- typedef int32(*gps_device_op)(gpsdevh *);
- typedef int32(*gps_device_op5)(const char *, gpsdevh **fd);
- typedef int32(*gps_device_op10)(gpsdevh * fd, GPS_PPacket *tra, GPS_PPacket *rec);
- typedef int32(*gps_device_op12)(gpsdevh * fd, GPS_PPacket packet);
- typedef int32(*gps_device_op13)(gpsdevh * fd, GPS_PPacket *packet);
+ typedef int32(*gps_device_op)(gpsdevh*);
+ typedef int32(*gps_device_op5)(const char*, gpsdevh** fd);
+ typedef int32(*gps_device_op10)(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec);
+ typedef int32(*gps_device_op12)(gpsdevh* fd, GPS_PPacket packet);
+ typedef int32(*gps_device_op13)(gpsdevh* fd, GPS_PPacket* packet);
typedef struct {
gps_device_op5 Device_On;
gps_device_op Device_Off;
return 1;
}
-static int32 gdu_on(const char *port, gpsdevh **fd)
+static int32 gdu_on(const char* port, gpsdevh** fd)
{
return gusb_init(port, fd);
}
-static int32 gdu_off(gpsdevh *dh)
+static int32 gdu_off(gpsdevh* dh)
{
return gusb_close(dh);
}
-static int32 gdu_read(gpsdevh *fd, GPS_PPacket *packet)
+static int32 gdu_read(gpsdevh* fd, GPS_PPacket* packet)
{
/* Default is to eat bulk request packets. */
return GPS_Packet_Read_usb(fd, packet, 1);
#include <time.h>
-static void GPS_Fmt_Print_Way100(GPS_PWay way, FILE *outf);
-static void GPS_Fmt_Print_Way101(GPS_PWay way, FILE *outf);
-static void GPS_Fmt_Print_Way102(GPS_PWay way, FILE *outf);
-static void GPS_Fmt_Print_Way103(GPS_PWay way, FILE *outf);
-static void GPS_Fmt_Print_Way104(GPS_PWay way, FILE *outf);
-static void GPS_Fmt_Print_Way105(GPS_PWay way, FILE *outf);
-static void GPS_Fmt_Print_Way106(GPS_PWay way, FILE *outf);
-static void GPS_Fmt_Print_Way107(GPS_PWay way, FILE *outf);
-static void GPS_Fmt_Print_Way108(GPS_PWay way, FILE *outf);
-static void GPS_Fmt_Print_Way109(GPS_PWay way, FILE *outf);
-static void GPS_Fmt_Print_Way150(GPS_PWay way, FILE *outf);
-static void GPS_Fmt_Print_Way151(GPS_PWay way, FILE *outf);
-static void GPS_Fmt_Print_Way152(GPS_PWay way, FILE *outf);
-static void GPS_Fmt_Print_Way154(GPS_PWay way, FILE *outf);
-static void GPS_Fmt_Print_Way155(GPS_PWay way, FILE *outf);
-
-static void GPS_Fmt_Print_Track301(GPS_PTrack *trk, int32 n, FILE *outf);
-static void GPS_Fmt_Print_D300(GPS_PTrack trk, FILE *outf);
-static void GPS_Fmt_Print_D301(GPS_PTrack trk, FILE *outf);
-
-static int32 GPS_Fmt_Print_Route201(GPS_PWay *way, int32 n, FILE *outf);
-
-
-char *gps_marine_sym[]= {
+static void GPS_Fmt_Print_Way100(GPS_PWay way, FILE* outf);
+static void GPS_Fmt_Print_Way101(GPS_PWay way, FILE* outf);
+static void GPS_Fmt_Print_Way102(GPS_PWay way, FILE* outf);
+static void GPS_Fmt_Print_Way103(GPS_PWay way, FILE* outf);
+static void GPS_Fmt_Print_Way104(GPS_PWay way, FILE* outf);
+static void GPS_Fmt_Print_Way105(GPS_PWay way, FILE* outf);
+static void GPS_Fmt_Print_Way106(GPS_PWay way, FILE* outf);
+static void GPS_Fmt_Print_Way107(GPS_PWay way, FILE* outf);
+static void GPS_Fmt_Print_Way108(GPS_PWay way, FILE* outf);
+static void GPS_Fmt_Print_Way109(GPS_PWay way, FILE* outf);
+static void GPS_Fmt_Print_Way150(GPS_PWay way, FILE* outf);
+static void GPS_Fmt_Print_Way151(GPS_PWay way, FILE* outf);
+static void GPS_Fmt_Print_Way152(GPS_PWay way, FILE* outf);
+static void GPS_Fmt_Print_Way154(GPS_PWay way, FILE* outf);
+static void GPS_Fmt_Print_Way155(GPS_PWay way, FILE* outf);
+
+static void GPS_Fmt_Print_Track301(GPS_PTrack* trk, int32 n, FILE* outf);
+static void GPS_Fmt_Print_D300(GPS_PTrack trk, FILE* outf);
+static void GPS_Fmt_Print_D301(GPS_PTrack trk, FILE* outf);
+
+static int32 GPS_Fmt_Print_Route201(GPS_PWay* way, int32 n, FILE* outf);
+
+
+char* gps_marine_sym[]= {
"Anchor","Bell","Diamond-grn","Diamond_red","Dive1","Dive2","Dollar",
"Fish","Fuel","Horn","House","Knife","Light","Mug","Skull",
"Square_grn","Square_red","Wbuoy","Wpt_dot","Wreck","Null","Mob",
-char *gps_land_sym[]= {
+char* gps_land_sym[]= {
"Is_hwy","Us_hwy","St_hwy","Mi_mrkr","Trcbck","Golf","Sml_cty",
"Med_cty","Lrg_cty","Freeway","Ntl_hwy","Cap_cty","Amuse_pk",
"Bowling","Car_rental","Car_repair","Fastfood","Fitness","Film",
};
-char *gps_aviation_sym[]= {
+char* gps_aviation_sym[]= {
"Airport","Int","Ndb","Vor","Heliport","Private","Soft_fld",
"Tall_tower","Short_tower","Glider","Ultralight","Parachute",
"Vortac","Vordme","Faf","Lom","Map","Tacan","Seaplane"
};
-char *gps_16_sym[]= {
+char* gps_16_sym[]= {
"Dot","House","Fuel","Car","Fish","Boat","Anchor","Wreck",
"Exit","Skull","Flag","Camp","Circle-x","Deer","1st_aid","Back_track"
};
** @return [void]
************************************************************************/
-void GPS_Fmt_Print_Time(time_t Time, FILE *outf)
+void GPS_Fmt_Print_Time(time_t Time, FILE* outf)
{
(void) fprintf(outf,"%s",ctime(&Time));
fflush(outf);
** @return [void]
************************************************************************/
-void GPS_Fmt_Print_Position(double lat, double lon, FILE *outf)
+void GPS_Fmt_Print_Position(double lat, double lon, FILE* outf)
{
(void) fprintf(outf,"Latitude: %f Longitude %f\n",lat,lon);
fflush(outf);
** @return [void]
************************************************************************/
-void GPS_Fmt_Print_Pvt(GPS_PPvt_Data pvt, FILE *outf)
+void GPS_Fmt_Print_Pvt(GPS_PPvt_Data pvt, FILE* outf)
{
(void) fprintf(outf,"Fix: ");
** @return [void]
************************************************************************/
-void GPS_Fmt_Print_Almanac(GPS_PAlmanac *alm, int32 n, FILE *outf)
+void GPS_Fmt_Print_Almanac(GPS_PAlmanac* alm, int32 n, FILE* outf)
{
int32 i;
int32 t;
** @return [void]
************************************************************************/
-void GPS_Fmt_Print_Track(GPS_PTrack *trk, int32 n, FILE *outf)
+void GPS_Fmt_Print_Track(GPS_PTrack* trk, int32 n, FILE* outf)
{
int32 i;
** @return [void]
************************************************************************/
-static void GPS_Fmt_Print_Track301(GPS_PTrack *trk, int32 n, FILE *outf)
+static void GPS_Fmt_Print_Track301(GPS_PTrack* trk, int32 n, FILE* outf)
{
int32 i;
** @return [void]
************************************************************************/
-static void GPS_Fmt_Print_D300(GPS_PTrack trk, FILE *outf)
+static void GPS_Fmt_Print_D300(GPS_PTrack trk, FILE* outf)
{
(void) fprintf(outf,"\tLatitude: %f\n",trk->lat);
(void) fprintf(outf,"\tLongitude: %f\n",trk->lon);
** @return [void]
************************************************************************/
-static void GPS_Fmt_Print_D301(GPS_PTrack trk, FILE *outf)
+static void GPS_Fmt_Print_D301(GPS_PTrack trk, FILE* outf)
{
(void) fprintf(outf,"\tLatitude: %f\n",trk->lat);
(void) fprintf(outf,"\tLongitude: %f\n",trk->lon);
** @return [int32] success
************************************************************************/
-int32 GPS_Fmt_Print_Waypoint(GPS_PWay *way, int32 n, FILE *outf)
+int32 GPS_Fmt_Print_Waypoint(GPS_PWay* way, int32 n, FILE* outf)
{
int32 i;
** @return [int32] success
************************************************************************/
-int32 GPS_Fmt_Print_Proximity(GPS_PWay *way, int32 n, FILE *outf)
+int32 GPS_Fmt_Print_Proximity(GPS_PWay* way, int32 n, FILE* outf)
{
int32 i;
** @return [void]
************************************************************************/
-static void GPS_Fmt_Print_Way100(GPS_PWay way, FILE *outf)
+static void GPS_Fmt_Print_Way100(GPS_PWay way, FILE* outf)
{
(void) fprintf(outf,"\tIdent: %-6.6s\n",way->ident);
** @return [void]
************************************************************************/
-static void GPS_Fmt_Print_Way101(GPS_PWay way, FILE *outf)
+static void GPS_Fmt_Print_Way101(GPS_PWay way, FILE* outf)
{
if (way->smbl > 176) {
** @return [void]
************************************************************************/
-static void GPS_Fmt_Print_Way102(GPS_PWay way, FILE *outf)
+static void GPS_Fmt_Print_Way102(GPS_PWay way, FILE* outf)
{
- char **p;
+ char** p;
int32 x;
if (way->smbl < 8192) {
** @return [void]
************************************************************************/
-static void GPS_Fmt_Print_Way103(GPS_PWay way, FILE *outf)
+static void GPS_Fmt_Print_Way103(GPS_PWay way, FILE* outf)
{
- static char *dspl[]= {
+ static char* dspl[]= {
"SW","S","SC"
};
** @return [void]
************************************************************************/
-static void GPS_Fmt_Print_Way104(GPS_PWay way, FILE *outf)
+static void GPS_Fmt_Print_Way104(GPS_PWay way, FILE* outf)
{
- static char *dspl[]= {
+ static char* dspl[]= {
"S","S","","SW","","SC"
};
- char **p;
+ char** p;
int32 x;
if (way->smbl < 8192) {
** @return [void]
************************************************************************/
-static void GPS_Fmt_Print_Way105(GPS_PWay way, FILE *outf)
+static void GPS_Fmt_Print_Way105(GPS_PWay way, FILE* outf)
{
- char **p;
+ char** p;
int32 x;
if (way->smbl < 8192) {
** @return [void]
************************************************************************/
-static void GPS_Fmt_Print_Way106(GPS_PWay way, FILE *outf)
+static void GPS_Fmt_Print_Way106(GPS_PWay way, FILE* outf)
{
- char **p;
+ char** p;
int32 x;
if (way->smbl < 8192) {
** @return [void]
************************************************************************/
-static void GPS_Fmt_Print_Way107(GPS_PWay way, FILE *outf)
+static void GPS_Fmt_Print_Way107(GPS_PWay way, FILE* outf)
{
- static char *dspl[]= {
+ static char* dspl[]= {
"SW","S","SC"
};
- static char *col[]= {
+ static char* col[]= {
"Default","Red","Green","Blue"
};
** @return [void]
************************************************************************/
-static void GPS_Fmt_Print_Way108(GPS_PWay way, FILE *outf)
+static void GPS_Fmt_Print_Way108(GPS_PWay way, FILE* outf)
{
- char **p;
+ char** p;
int32 x;
- static char *dspl[]= {
+ static char* dspl[]= {
"SW","S","SC"
};
- static char *col[]= {
+ static char* col[]= {
"Black","Dark_Red","Dark_Green","Dark_Yellow","Dark_Blue",
"Dark_Magenta","Dark_Cyan","Light_Grey","Dark_Grey","Red","Green",
"Yellow","Blue","Magenta","Cyan","White"
** @return [void]
************************************************************************/
-static void GPS_Fmt_Print_Way109(GPS_PWay way, FILE *outf)
+static void GPS_Fmt_Print_Way109(GPS_PWay way, FILE* outf)
{
- char **p;
+ char** p;
int32 x;
- static char *dspl[]= {
+ static char* dspl[]= {
"SW","S","SC"
};
- static char *col[]= {
+ static char* col[]= {
"Black","Dark_Red","Dark_Green","Dark_Yellow","Dark_Blue",
"Dark_Magenta","Dark_Cyan","Light_Grey","Dark_Grey","Red","Green",
"Yellow","Blue","Magenta","Cyan","White"
** @return [void]
************************************************************************/
-static void GPS_Fmt_Print_Way150(GPS_PWay way, FILE *outf)
+static void GPS_Fmt_Print_Way150(GPS_PWay way, FILE* outf)
{
(void) fprintf(outf,"\tIdent: %-6.6s\n",way->ident);
** @return [void]
************************************************************************/
-static void GPS_Fmt_Print_Way151(GPS_PWay way, FILE *outf)
+static void GPS_Fmt_Print_Way151(GPS_PWay way, FILE* outf)
{
(void) fprintf(outf,"\tIdent: %-6.6s\n",way->ident);
** @return [void]
************************************************************************/
-static void GPS_Fmt_Print_Way152(GPS_PWay way, FILE *outf)
+static void GPS_Fmt_Print_Way152(GPS_PWay way, FILE* outf)
{
(void) fprintf(outf,"\tIdent: %-6.6s\n",way->ident);
** @return [void]
************************************************************************/
-static void GPS_Fmt_Print_Way154(GPS_PWay way, FILE *outf)
+static void GPS_Fmt_Print_Way154(GPS_PWay way, FILE* outf)
{
- char **p;
+ char** p;
int32 x;
if (way->smbl < 8192) {
** @return [void]
************************************************************************/
-static void GPS_Fmt_Print_Way155(GPS_PWay way, FILE *outf)
+static void GPS_Fmt_Print_Way155(GPS_PWay way, FILE* outf)
{
- static char *dspl[]= {
+ static char* dspl[]= {
"","S","","SW","","SC"
};
- char **p;
+ char** p;
int32 x;
if (way->smbl < 8192) {
** @return [int32] success
************************************************************************/
-int32 GPS_Fmt_Print_Route(GPS_PWay *way, int32 n, FILE *outf)
+int32 GPS_Fmt_Print_Route(GPS_PWay* way, int32 n, FILE* outf)
{
int32 i;
int32 first;
** @return [int32] success
************************************************************************/
-static int32 GPS_Fmt_Print_Route201(GPS_PWay *way, int32 n, FILE *outf)
+static int32 GPS_Fmt_Print_Route201(GPS_PWay* way, int32 n, FILE* outf)
{
int32 i;
int32 first;
#include <stdio.h>
#include <time.h>
- void GPS_Fmt_Print_Time(time_t Time, FILE *outf);
- void GPS_Fmt_Print_Position(double lat, double lon, FILE *outf);
- void GPS_Fmt_Print_Pvt(GPS_PPvt_Data pvt, FILE *outf);
- void GPS_Fmt_Print_Almanac(GPS_PAlmanac *alm, int32 n, FILE *outf);
- void GPS_Fmt_Print_Track(GPS_PTrack *trk, int32 n, FILE *outf);
- int32 GPS_Fmt_Print_Waypoint(GPS_PWay *way, int32 n, FILE *outf);
- int32 GPS_Fmt_Print_Proximity(GPS_PWay *way, int32 n, FILE *outf);
- int32 GPS_Fmt_Print_Route(GPS_PWay *way, int32 n, FILE *outf);
+ void GPS_Fmt_Print_Time(time_t Time, FILE* outf);
+ void GPS_Fmt_Print_Position(double lat, double lon, FILE* outf);
+ void GPS_Fmt_Print_Pvt(GPS_PPvt_Data pvt, FILE* outf);
+ void GPS_Fmt_Print_Almanac(GPS_PAlmanac* alm, int32 n, FILE* outf);
+ void GPS_Fmt_Print_Track(GPS_PTrack* trk, int32 n, FILE* outf);
+ int32 GPS_Fmt_Print_Waypoint(GPS_PWay* way, int32 n, FILE* outf);
+ int32 GPS_Fmt_Print_Proximity(GPS_PWay* way, int32 n, FILE* outf);
+ int32 GPS_Fmt_Print_Route(GPS_PWay* way, int32 n, FILE* outf);
#endif
#include <stdlib.h>
-static int32 GPS_Input_Load_String(char *t, int32 n, char *s);
-static int32 GPS_Input_Load_Strnull(char *t, char *s);
-static int32 GPS_Input_Read_Line(char *s, FILE *inf);
-
-static int32 GPS_Input_Get_D100(GPS_PWay *way, FILE *inf);
-static int32 GPS_Input_Get_D101(GPS_PWay *way, FILE *inf);
-static int32 GPS_Input_Get_D102(GPS_PWay *way, FILE *inf);
-static int32 GPS_Input_Get_D103(GPS_PWay *way, FILE *inf);
-static int32 GPS_Input_Get_D104(GPS_PWay *way, FILE *inf);
-static int32 GPS_Input_Get_D105(GPS_PWay *way, FILE *inf);
-static int32 GPS_Input_Get_D106(GPS_PWay *way, FILE *inf);
-static int32 GPS_Input_Get_D107(GPS_PWay *way, FILE *inf);
-static int32 GPS_Input_Get_D108(GPS_PWay *way, FILE *inf);
-static int32 GPS_Input_Get_D109(GPS_PWay *way, FILE *inf, int protonum);
-static int32 GPS_Input_Get_D150(GPS_PWay *way, FILE *inf);
-static int32 GPS_Input_Get_D151(GPS_PWay *way, FILE *inf);
-static int32 GPS_Input_Get_D152(GPS_PWay *way, FILE *inf);
-static int32 GPS_Input_Get_D154(GPS_PWay *way, FILE *inf);
-static int32 GPS_Input_Get_D155(GPS_PWay *way, FILE *inf);
-
-static int32 GPS_Input_Get_Track301(GPS_PTrack **trk, FILE *inf, int32 type,
+static int32 GPS_Input_Load_String(char* t, int32 n, char* s);
+static int32 GPS_Input_Load_Strnull(char* t, char* s);
+static int32 GPS_Input_Read_Line(char* s, FILE* inf);
+
+static int32 GPS_Input_Get_D100(GPS_PWay* way, FILE* inf);
+static int32 GPS_Input_Get_D101(GPS_PWay* way, FILE* inf);
+static int32 GPS_Input_Get_D102(GPS_PWay* way, FILE* inf);
+static int32 GPS_Input_Get_D103(GPS_PWay* way, FILE* inf);
+static int32 GPS_Input_Get_D104(GPS_PWay* way, FILE* inf);
+static int32 GPS_Input_Get_D105(GPS_PWay* way, FILE* inf);
+static int32 GPS_Input_Get_D106(GPS_PWay* way, FILE* inf);
+static int32 GPS_Input_Get_D107(GPS_PWay* way, FILE* inf);
+static int32 GPS_Input_Get_D108(GPS_PWay* way, FILE* inf);
+static int32 GPS_Input_Get_D109(GPS_PWay* way, FILE* inf, int protonum);
+static int32 GPS_Input_Get_D150(GPS_PWay* way, FILE* inf);
+static int32 GPS_Input_Get_D151(GPS_PWay* way, FILE* inf);
+static int32 GPS_Input_Get_D152(GPS_PWay* way, FILE* inf);
+static int32 GPS_Input_Get_D154(GPS_PWay* way, FILE* inf);
+static int32 GPS_Input_Get_D155(GPS_PWay* way, FILE* inf);
+
+static int32 GPS_Input_Get_Track301(GPS_PTrack** trk, FILE* inf, int32 type,
int32 n);
-static int32 GPS_Input_Get_D300(GPS_PTrack *trk, FILE *inf, char *s);
-static int32 GPS_Input_Get_D301(GPS_PTrack *trk, FILE *inf, char *s);
+static int32 GPS_Input_Get_D300(GPS_PTrack* trk, FILE* inf, char* s);
+static int32 GPS_Input_Get_D301(GPS_PTrack* trk, FILE* inf, char* s);
-static int32 GPS_Input_Get_Route201(GPS_PWay **way, FILE *inf);
+static int32 GPS_Input_Get_Route201(GPS_PWay** way, FILE* inf);
/* @funcstatic GPS_Input_Load_String ***********************************
**
** @return [int32] success
************************************************************************/
-static int32 GPS_Input_Load_String(char *t, int32 n, char *s)
+static int32 GPS_Input_Load_String(char* t, int32 n, char* s)
{
- char *p;
- char *q;
+ char* p;
+ char* q;
int32 len;
int32 i;
**
** @return [int32] success
************************************************************************/
-static int32 GPS_Input_Load_Strnull(char *t, char *s)
+static int32 GPS_Input_Load_Strnull(char* t, char* s)
{
- char *p;
- char *q;
+ char* p;
+ char* q;
gps_errno = INPUT_ERROR;
** @return [int32] success
************************************************************************/
-static int32 GPS_Input_Read_Line(char *s, FILE *inf)
+static int32 GPS_Input_Read_Line(char* s, FILE* inf)
{
int32 len;
** @return [int32] number of entries
************************************************************************/
-int32 GPS_Input_Get_Almanac(GPS_PAlmanac **alm, FILE *inf)
+int32 GPS_Input_Get_Almanac(GPS_PAlmanac** alm, FILE* inf)
{
char s[GPS_ARB_LEN];
int32 n;
int32 i;
int32 d;
float f;
- char *p;
+ char* p;
gps_errno = INPUT_ERROR;
return gps_errno;
}
- if (sscanf(s,"Almanac %d%d",(int *)&n,(int *)&type)!=2) {
+ if (sscanf(s,"Almanac %d%d",(int*)&n,(int*)&type)!=2) {
return gps_errno;
}
if (!type) {
- if (!(*alm = (GPS_PAlmanac *) malloc(32*sizeof(GPS_PAlmanac *)))) {
+ if (!(*alm = (GPS_PAlmanac*) malloc(32*sizeof(GPS_PAlmanac*)))) {
return MEMORY_ERROR;
}
for (i=0; i<32; ++i) {
(*alm)[i]->wn = -1;
}
} else {
- if (!(*alm = (GPS_PAlmanac *) malloc(n*sizeof(GPS_PAlmanac *)))) {
+ if (!(*alm = (GPS_PAlmanac*) malloc(n*sizeof(GPS_PAlmanac*)))) {
return MEMORY_ERROR;
}
for (i=0; i<32; ++i)
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
--d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*alm)[i]->wn = d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*alm)[i]->hlth=d;
** @return [int32] number of entries
************************************************************************/
-int32 GPS_Input_Get_Waypoint(GPS_PWay **way, FILE *inf)
+int32 GPS_Input_Get_Waypoint(GPS_PWay** way, FILE* inf)
{
char s[GPS_ARB_LEN];
int32 n;
if (!GPS_Input_Read_Line(s,inf)) {
return gps_errno;
}
- if (sscanf(s,"Waypoints Type: %d",(int *)&type)!=1) {
+ if (sscanf(s,"Waypoints Type: %d",(int*)&type)!=1) {
return gps_errno;
}
}
fseek(inf,pos,0);
- if (!(*way=(GPS_PWay *)malloc(n*sizeof(GPS_PWay *)))) {
+ if (!(*way=(GPS_PWay*)malloc(n*sizeof(GPS_PWay*)))) {
return MEMORY_ERROR;
}
for (i=0; i<n; ++i) {
** @return [int32] number of entries
************************************************************************/
-int32 GPS_Input_Get_Proximity(GPS_PWay **way, FILE *inf)
+int32 GPS_Input_Get_Proximity(GPS_PWay** way, FILE* inf)
{
char s[GPS_ARB_LEN];
int32 n;
long pos;
int32 ret;
double f;
- char *p;
+ char* p;
gps_errno = INPUT_ERROR;
if (!GPS_Input_Read_Line(s,inf)) {
return gps_errno;
}
- if (sscanf(s,"Waypoints Type: %d",(int *)&type)!=1) {
+ if (sscanf(s,"Waypoints Type: %d",(int*)&type)!=1) {
return gps_errno;
}
}
fseek(inf,pos,0);
- if (!(*way=(GPS_PWay *)malloc(n*sizeof(GPS_PWay *)))) {
+ if (!(*way=(GPS_PWay*)malloc(n*sizeof(GPS_PWay*)))) {
return MEMORY_ERROR;
}
for (i=0; i<n; ++i) {
**
** @return [int32] number of entries
************************************************************************/
-static int32 GPS_Input_Get_D100(GPS_PWay *way, FILE *inf)
+static int32 GPS_Input_Get_D100(GPS_PWay* way, FILE* inf)
{
char s[GPS_ARB_LEN];
- char *p;
+ char* p;
double f;
**
** @return [int32] number of entries
************************************************************************/
-static int32 GPS_Input_Get_D101(GPS_PWay *way, FILE *inf)
+static int32 GPS_Input_Get_D101(GPS_PWay* way, FILE* inf)
{
char s[GPS_ARB_LEN];
- char *p;
+ char* p;
double f;
int32 d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->smbl = d;
**
** @return [int32] number of entries
************************************************************************/
-static int32 GPS_Input_Get_D102(GPS_PWay *way, FILE *inf)
+static int32 GPS_Input_Get_D102(GPS_PWay* way, FILE* inf)
{
return GPS_Input_Get_D101(way,inf);
}
**
** @return [int32] number of entries
************************************************************************/
-static int32 GPS_Input_Get_D103(GPS_PWay *way, FILE *inf)
+static int32 GPS_Input_Get_D103(GPS_PWay* way, FILE* inf)
{
char s[GPS_ARB_LEN];
- char *p;
+ char* p;
double f;
int32 d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->smbl = d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->dspl = d;
**
** @return [int32] number of entries
************************************************************************/
-static int32 GPS_Input_Get_D104(GPS_PWay *way, FILE *inf)
+static int32 GPS_Input_Get_D104(GPS_PWay* way, FILE* inf)
{
return GPS_Input_Get_D103(way,inf);
}
**
** @return [int32] number of entries
************************************************************************/
-static int32 GPS_Input_Get_D105(GPS_PWay *way, FILE *inf)
+static int32 GPS_Input_Get_D105(GPS_PWay* way, FILE* inf)
{
char s[GPS_ARB_LEN];
- char *p;
+ char* p;
double f;
int32 d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->smbl = d;
**
** @return [int32] number of entries
************************************************************************/
-static int32 GPS_Input_Get_D106(GPS_PWay *way, FILE *inf)
+static int32 GPS_Input_Get_D106(GPS_PWay* way, FILE* inf)
{
char s[GPS_ARB_LEN];
- char *p;
+ char* p;
double f;
int32 d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->wpt_class = d;
if (!GPS_Input_Read_Line(s,inf)) {
return gps_errno;
}
- GPS_Input_Load_String((char *)(*way)->subclass,13,s);
+ GPS_Input_Load_String((char*)(*way)->subclass,13,s);
if (!GPS_Input_Read_Line(s,inf)) {
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->smbl = d;
**
** @return [int32] number of entries
************************************************************************/
-static int32 GPS_Input_Get_D107(GPS_PWay *way, FILE *inf)
+static int32 GPS_Input_Get_D107(GPS_PWay* way, FILE* inf)
{
char s[GPS_ARB_LEN];
- char *p;
+ char* p;
int32 d;
int32 ret;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->colour = d;
**
** @return [int32] number of entries
************************************************************************/
-static int32 GPS_Input_Get_D108(GPS_PWay *way, FILE *inf)
+static int32 GPS_Input_Get_D108(GPS_PWay* way, FILE* inf)
{
char s[GPS_ARB_LEN];
- char *p;
+ char* p;
double f;
int32 d;
int32 xc;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->colour = d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->dspl = d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->smbl = d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->alt = d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->wpt_class = d;
if (!GPS_Input_Read_Line(s,inf)) {
return gps_errno;
}
- GPS_Input_Load_String((char *)(*way)->subclass,18,s);
+ GPS_Input_Load_String((char*)(*way)->subclass,18,s);
} else {
GPS_Util_Put_Short((*way)->subclass,0);
GPS_Util_Put_Int((*way)->subclass+2,0);
** @return [int32] number of entries
** D109's and D110's are so similar, we handle both with the same function.
************************************************************************/
-static int32 GPS_Input_Get_D109(GPS_PWay *way, FILE *inf, int protonum)
+static int32 GPS_Input_Get_D109(GPS_PWay* way, FILE* inf, int protonum)
{
char s[GPS_ARB_LEN];
- char *p;
+ char* p;
double f;
int32 d;
int32 xc;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->colour = d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->dspl = d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->smbl = d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->alt = d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->wpt_class = d;
if (!GPS_Input_Read_Line(s,inf)) {
return gps_errno;
}
- GPS_Input_Load_String((char *)(*way)->subclass,18,s);
+ GPS_Input_Load_String((char*)(*way)->subclass,18,s);
} else {
GPS_Util_Put_Short((*way)->subclass,0);
GPS_Util_Put_Int((*way)->subclass+2,0);
**
** @return [int32] number of entries
************************************************************************/
-static int32 GPS_Input_Get_D150(GPS_PWay *way, FILE *inf)
+static int32 GPS_Input_Get_D150(GPS_PWay* way, FILE* inf)
{
char s[GPS_ARB_LEN];
- char *p;
+ char* p;
double f;
int32 d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->wpt_class = cl = d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->alt = d;
**
** @return [int32] number of entries
************************************************************************/
-static int32 GPS_Input_Get_D151(GPS_PWay *way, FILE *inf)
+static int32 GPS_Input_Get_D151(GPS_PWay* way, FILE* inf)
{
char s[GPS_ARB_LEN];
- char *p;
+ char* p;
double f;
int32 d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->wpt_class = cl = d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->alt = d;
**
** @return [int32] number of entries
************************************************************************/
-static int32 GPS_Input_Get_D152(GPS_PWay *way, FILE *inf)
+static int32 GPS_Input_Get_D152(GPS_PWay* way, FILE* inf)
{
return GPS_Input_Get_D150(way,inf);
}
**
** @return [int32] number of entries
************************************************************************/
-static int32 GPS_Input_Get_D154(GPS_PWay *way, FILE *inf)
+static int32 GPS_Input_Get_D154(GPS_PWay* way, FILE* inf)
{
char s[GPS_ARB_LEN];
- char *p;
+ char* p;
double f;
int32 d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->smbl = d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->wpt_class = cl = d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->alt = d;
**
** @return [int32] number of entries
************************************************************************/
-static int32 GPS_Input_Get_D155(GPS_PWay *way, FILE *inf)
+static int32 GPS_Input_Get_D155(GPS_PWay* way, FILE* inf)
{
char s[GPS_ARB_LEN];
- char *p;
+ char* p;
double f;
int32 d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->smbl = d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->dspl = d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->wpt_class = cl = d;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_errno;
}
(*way)->alt = d;
** @return [int32] number of entries
************************************************************************/
-int32 GPS_Input_Get_Track(GPS_PTrack **trk, FILE *inf)
+int32 GPS_Input_Get_Track(GPS_PTrack** trk, FILE* inf)
{
char s[GPS_ARB_LEN];
int32 n;
return gps_errno;
}
- if (sscanf(s,"Track log %d%d",(int *)&a,(int *)&d)!=2) {
+ if (sscanf(s,"Track log %d%d",(int*)&a,(int*)&d)!=2) {
return INPUT_ERROR;
}
fseek(inf,pos,0);
- if (!(*trk=(GPS_PTrack *)malloc(n*sizeof(GPS_PTrack *)))) {
+ if (!(*trk=(GPS_PTrack*)malloc(n*sizeof(GPS_PTrack*)))) {
return MEMORY_ERROR;
}
for (i=0; i<n; ++i)
** @return [int32] number of entries
************************************************************************/
-static int32 GPS_Input_Get_Track301(GPS_PTrack **trk, FILE *inf, int32 type,
+static int32 GPS_Input_Get_Track301(GPS_PTrack** trk, FILE* inf, int32 type,
int32 n)
{
char s[GPS_ARB_LEN];
int32 i;
- char *p;
+ char* p;
int32 x;
for (i=0; i<n; ++i) {
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&x)!=1) {
+ if (sscanf(p+1,"%d",(int*)&x)!=1) {
return INPUT_ERROR;
}
(*trk)[i]->dspl = x;
return gps_errno;
}
p=strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&x)!=1) {
+ if (sscanf(p+1,"%d",(int*)&x)!=1) {
return INPUT_ERROR;
}
(*trk)[i]->colour = x;
** @return [int32] number of entries
************************************************************************/
-static int32 GPS_Input_Get_D300(GPS_PTrack *trk, FILE *inf, char *s)
+static int32 GPS_Input_Get_D300(GPS_PTrack* trk, FILE* inf, char* s)
{
- char *p;
+ char* p;
double f;
p=strchr(s,':');
** @return [int32] number of entries
************************************************************************/
-static int32 GPS_Input_Get_D301(GPS_PTrack *trk, FILE *inf, char *s)
+static int32 GPS_Input_Get_D301(GPS_PTrack* trk, FILE* inf, char* s)
{
- char *p;
+ char* p;
double f;
p=strchr(s,':');
** @return [int32] number of entries
************************************************************************/
-int32 GPS_Input_Get_Route(GPS_PWay **way, FILE *inf)
+int32 GPS_Input_Get_Route(GPS_PWay** way, FILE* inf)
{
char s[GPS_ARB_LEN];
int32 n;
int32 i;
long pos;
int32 ret;
- char *p;
+ char* p;
int32 d;
gps_errno = INPUT_ERROR;
if (!GPS_Input_Read_Line(s,inf)) {
return gps_errno;
}
- if (sscanf(s,"Route log %d",(int *)&atype)!=1) {
+ if (sscanf(s,"Route log %d",(int*)&atype)!=1) {
return gps_errno;
}
if (!GPS_Input_Read_Line(s,inf)) {
if (!GPS_Input_Read_Line(s,inf)) {
return gps_errno;
}
- if (sscanf(s,"Route Type: %d",(int *)&rtype)!=1) {
+ if (sscanf(s,"Route Type: %d",(int*)&rtype)!=1) {
return gps_errno;
}
if (!GPS_Input_Read_Line(s,inf)) {
return gps_errno;
}
- if (sscanf(s,"Waypoints Type: %d",(int *)&type)!=1) {
+ if (sscanf(s,"Waypoints Type: %d",(int*)&type)!=1) {
return gps_errno;
}
fseek(inf,0L,0);
- if (!(*way=(GPS_PWay *)malloc(n*sizeof(GPS_PWay *)))) {
+ if (!(*way=(GPS_PWay*)malloc(n*sizeof(GPS_PWay*)))) {
return MEMORY_ERROR;
}
for (i=0; i<n; ++i) {
case 200:
p = strchr(s,':');
p = strchr(p+1,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_error;
}
(*way)[i]->rte_num=d;
case 201:
p = strchr(s,':');
p = strchr(p+1,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_error;
}
(*way)[i]->rte_num=d;
** @return [int32] number of entries
************************************************************************/
-static int32 GPS_Input_Get_Route201(GPS_PWay **way, FILE *inf)
+static int32 GPS_Input_Get_Route201(GPS_PWay** way, FILE* inf)
{
char s[GPS_ARB_LEN];
int32 n;
int32 i;
long pos;
int32 ret;
- char *p;
+ char* p;
int32 d;
gps_errno = INPUT_ERROR;
if (!GPS_Input_Read_Line(s,inf)) {
return gps_errno;
}
- if (sscanf(s,"Route Type: %d",(int *)&rtype)!=1) {
+ if (sscanf(s,"Route Type: %d",(int*)&rtype)!=1) {
return gps_errno;
}
if (!GPS_Input_Read_Line(s,inf)) {
return gps_errno;
}
- if (sscanf(s,"Waypoints Type: %d",(int *)&type)!=1) {
+ if (sscanf(s,"Waypoints Type: %d",(int*)&type)!=1) {
return gps_errno;
}
}
fseek(inf,0L,0);
- if (!(*way=(GPS_PWay *)malloc(n*sizeof(GPS_PWay *)))) {
+ if (!(*way=(GPS_PWay*)malloc(n*sizeof(GPS_PWay*)))) {
return MEMORY_ERROR;
}
for (i=0; i<n; ++i) {
case 200:
p = strchr(s,':');
p = strchr(p+1,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_error;
}
(*way)[i]->rte_num=d;
case 201:
p = strchr(s,':');
p = strchr(p+1,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_error;
}
(*way)[i]->rte_num=d;
(*way)[i]->islink = 1;
p = strchr(s,':');
- if (sscanf(p+1,"%d",(int *)&d)!=1) {
+ if (sscanf(p+1,"%d",(int*)&d)!=1) {
return gps_error;
}
(*way)[i]->rte_link_class=d;
}
GPS_Input_Load_String((*way)[i]->rte_link_subclass,18,s);
} else {
- GPS_Util_Put_Short((UC *)(*way)[i]->rte_link_subclass,0);
- GPS_Util_Put_Int((UC *)(*way)[i]->rte_link_subclass+2,0);
- GPS_Util_Put_Uint((UC *)(*way)[i]->rte_link_subclass+6,
+ GPS_Util_Put_Short((UC*)(*way)[i]->rte_link_subclass,0);
+ GPS_Util_Put_Int((UC*)(*way)[i]->rte_link_subclass+2,0);
+ GPS_Util_Put_Uint((UC*)(*way)[i]->rte_link_subclass+6,
0xffffffff);
- GPS_Util_Put_Uint((UC *)(*way)[i]->rte_link_subclass+10,
+ GPS_Util_Put_Uint((UC*)(*way)[i]->rte_link_subclass+10,
0xffffffff);
- GPS_Util_Put_Uint((UC *)(*way)[i]->rte_link_subclass+14,
+ GPS_Util_Put_Uint((UC*)(*way)[i]->rte_link_subclass+14,
0xffffffff);
}
#include "gps.h"
- int32 GPS_Input_Get_Almanac(GPS_PAlmanac **alm, FILE *inf);
- int32 GPS_Input_Get_Waypoint(GPS_PWay **way, FILE *inf);
- int32 GPS_Input_Get_Proximity(GPS_PWay **way, FILE *inf);
- int32 GPS_Input_Get_Track(GPS_PTrack **trk, FILE *inf);
- int32 GPS_Input_Get_Route(GPS_PWay **way, FILE *inf);
+ int32 GPS_Input_Get_Almanac(GPS_PAlmanac** alm, FILE* inf);
+ int32 GPS_Input_Get_Waypoint(GPS_PWay** way, FILE* inf);
+ int32 GPS_Input_Get_Proximity(GPS_PWay** way, FILE* inf);
+ int32 GPS_Input_Get_Track(GPS_PTrack** trk, FILE* inf);
+ int32 GPS_Input_Get_Route(GPS_PWay** way, FILE* inf);
#endif
#define TMOUT_B 5000 /* Milliseconds to timeout bulk pipe access. */
typedef struct {
- struct usb_bus *busses;
+ struct usb_bus* busses;
unsigned product_id;
} libusb_unit_data;
static int gusb_bulk_out_ep;
static int gusb_bulk_in_ep;
-static usb_dev_handle *udev;
-static int garmin_usb_scan(libusb_unit_data *, int);
-static const gdx_info *gdx;
+static usb_dev_handle* udev;
+static int garmin_usb_scan(libusb_unit_data*, int);
+static const gdx_info* gdx;
-static int gusb_libusb_get(garmin_usb_packet *ibuf, size_t sz);
-static int gusb_libusb_get_bulk(garmin_usb_packet *ibuf, size_t sz);
-static int gusb_teardown(gpsdevh *dh);
-static int gusb_libusb_send(const garmin_usb_packet *opkt, size_t sz);
+static int gusb_libusb_get(garmin_usb_packet* ibuf, size_t sz);
+static int gusb_libusb_get_bulk(garmin_usb_packet* ibuf, size_t sz);
+static int gusb_teardown(gpsdevh* dh);
+static int gusb_libusb_send(const garmin_usb_packet* opkt, size_t sz);
static gusb_llops_t libusb_llops = {
gusb_libusb_get,
#if __linux__
static
-char ** os_get_garmin_mountpoints()
+char** os_get_garmin_mountpoints()
{
// Hacked for testing.
return NULL;
// vendor ID and match that against the mounted device table. In practical
// matters, that's crazy complex and this is where the devices seems to always
// get mounted...
-char ** os_get_garmin_mountpoints()
+char** os_get_garmin_mountpoints()
{
- char **dlist = (char **) xcalloc(2, sizeof *dlist);
+ char** dlist = (char**) xcalloc(2, sizeof *dlist);
dlist[0] = xstrdup("/Volumes/GARMIN");
dlist[1] = NULL;
return dlist;
}
#else
-char ** os_get_garmin_mountpoints()
+char** os_get_garmin_mountpoints()
{
return NULL;
}
static int
-gusb_libusb_send(const garmin_usb_packet *opkt, size_t sz)
+gusb_libusb_send(const garmin_usb_packet* opkt, size_t sz)
{
int r;
- r = usb_bulk_write(udev, gusb_bulk_out_ep, (char *)(void *)opkt->dbuf, sz, TMOUT_B);
+ r = usb_bulk_write(udev, gusb_bulk_out_ep, (char*)(void*)opkt->dbuf, sz, TMOUT_B);
if (r != (int) sz) {
fprintf(stderr, "Bad cmdsend r %d sz %ld\n", r, (unsigned long) sz);
}
static int
-gusb_libusb_get(garmin_usb_packet *ibuf, size_t sz)
+gusb_libusb_get(garmin_usb_packet* ibuf, size_t sz)
{
- unsigned char *buf = &ibuf->dbuf[0];
+ unsigned char* buf = &ibuf->dbuf[0];
int r = -1;
- r = usb_interrupt_read(udev, gusb_intr_in_ep, (char *) buf, sz, TMOUT_I);
+ r = usb_interrupt_read(udev, gusb_intr_in_ep, (char*) buf, sz, TMOUT_I);
return r;
}
static int
-gusb_libusb_get_bulk(garmin_usb_packet *ibuf, size_t sz)
+gusb_libusb_get_bulk(garmin_usb_packet* ibuf, size_t sz)
{
int r;
- unsigned char *buf = &ibuf->dbuf[0];
+ unsigned char* buf = &ibuf->dbuf[0];
- r = usb_bulk_read(udev, gusb_bulk_in_ep, (char *) buf, sz, TMOUT_B);
+ r = usb_bulk_read(udev, gusb_bulk_in_ep, (char*) buf, sz, TMOUT_B);
return r;
}
static int
-gusb_teardown(gpsdevh *dh)
+gusb_teardown(gpsdevh* dh)
{
if (udev) {
usb_release_interface(udev, 0);
* #3 actually starts the session now that the above are both clear.
*/
- gusb_cmd_send((const garmin_usb_packet *) oinit, sizeof(oinit));
- gusb_cmd_send((const garmin_usb_packet *) oinit, sizeof(oinit));
- gusb_cmd_send((const garmin_usb_packet *) oinit, sizeof(oinit));
+ gusb_cmd_send((const garmin_usb_packet*) oinit, sizeof(oinit));
+ gusb_cmd_send((const garmin_usb_packet*) oinit, sizeof(oinit));
+ gusb_cmd_send((const garmin_usb_packet*) oinit, sizeof(oinit));
t = 10;
while (1) {
*/
t = 10;
- gusb_cmd_send((const garmin_usb_packet *) oid, sizeof(oid));
+ gusb_cmd_send((const garmin_usb_packet*) oid, sizeof(oid));
while (1) {
le_write16(&iresp.gusb_pkt.pkt_id, 0);
le_write32(&iresp.gusb_pkt.datasz, 0);
}
void
-garmin_usb_start(struct usb_device *dev, libusb_unit_data *lud)
+garmin_usb_start(struct usb_device* dev, libusb_unit_data* lud)
{
int i;
}
for (i = 0; i < dev->config->interface->altsetting->bNumEndpoints; i++) {
- struct usb_endpoint_descriptor * ep;
+ struct usb_endpoint_descriptor* ep;
ep = &dev->config->interface->altsetting->endpoint[i];
switch (ep->bmAttributes & USB_ENDPOINT_TYPE_MASK) {
}
static
-int garmin_usb_scan(libusb_unit_data *lud, int req_unit_number)
+int garmin_usb_scan(libusb_unit_data* lud, int req_unit_number)
{
int found_devices = 0;
- struct usb_bus *bus;
+ struct usb_bus* bus;
for (bus = lud->busses; bus; bus = bus->next) {
- struct usb_device *dev;
+ struct usb_device* dev;
for (dev = bus->devices; dev; dev = dev->next) {
/*
* that is wants to read and write GPX files on a
* mounted drive. Try that now.
*/
- char **dlist = os_get_garmin_mountpoints();
+ char** dlist = os_get_garmin_mountpoints();
gdx = gdx_find_file(dlist);
if (gdx) {
return 1;
int
-gusb_init(const char *portname, gpsdevh **dh)
+gusb_init(const char* portname, gpsdevh** dh)
{
int req_unit_number = 0;
- libusb_unit_data *lud = (libusb_unit_data*) xcalloc(sizeof(libusb_unit_data), 1);
+ libusb_unit_data* lud = (libusb_unit_data*) xcalloc(sizeof(libusb_unit_data), 1);
*dh = (gpsdevh*) lud;
#include "gpsdatum.h"
-static int32 GPS_Math_LatLon_To_UTM_Param(double lat, double lon, int32 *zone,
- char *zc, double *Mc, double *E0,
- double *N0, double *F0);
-static int32 GPS_Math_UTM_Param_To_Mc(int32 zone, char zc, double *Mc,
- double *E0, double *N0, double *F0);
+static int32 GPS_Math_LatLon_To_UTM_Param(double lat, double lon, int32* zone,
+ char* zc, double* Mc, double* E0,
+ double* N0, double* F0);
+static int32 GPS_Math_UTM_Param_To_Mc(int32 zone, char zc, double* Mc,
+ double* E0, double* N0, double* F0);
** @return [void]
************************************************************************/
-void GPS_Math_Deg_To_DegMin(double v, int32 *d, double *m)
+void GPS_Math_Deg_To_DegMin(double v, int32* d, double* m)
{
int32 sign;
** @return [void]
************************************************************************/
-void GPS_Math_DegMin_To_Deg(int32 d, double m, double *deg)
+void GPS_Math_DegMin_To_Deg(int32 d, double m, double* deg)
{
*deg = ((double)abs(d)) + m / (double)60.0;
** @return [void]
************************************************************************/
-void GPS_Math_Deg_To_DegMinSec(double v, int32 *d, int32 *m, double *s)
+void GPS_Math_Deg_To_DegMinSec(double v, int32* d, int32* m, double* s)
{
int32 sign;
double t;
** @return [void]
************************************************************************/
-void GPS_Math_DegMinSec_To_Deg(int32 d, int32 m, double s, double *deg)
+void GPS_Math_DegMinSec_To_Deg(int32 d, int32 m, double s, double* deg)
{
*deg = ((double)abs(d)) + ((double)m + s / (double)60.0) / (double)60.0;
** @return [void]
************************************************************************/
void GPS_Math_LatLonH_To_XYZ(double phi, double lambda, double H,
- double *x, double *y, double *z,
+ double* x, double* y, double* z,
double a, double b)
{
double esq;
**
** @return [void]
************************************************************************/
-void GPS_Math_XYZ_To_LatLonH(double *phi, double *lambda, double *H,
+void GPS_Math_XYZ_To_LatLonH(double* phi, double* lambda, double* H,
double x, double y, double z,
double a, double b)
{
** @return [void]
************************************************************************/
void GPS_Math_Airy1830LatLonH_To_XYZ(double phi, double lambda, double H,
- double *x, double *y, double *z)
+ double* x, double* y, double* z)
{
double a = 6377563.396;
double b = 6356256.910;
** @return [void]
************************************************************************/
void GPS_Math_WGS84LatLonH_To_XYZ(double phi, double lambda, double H,
- double *x, double *y, double *z)
+ double* x, double* y, double* z)
{
double a = 6378137.000;
double b = 6356752.3141;
**
** @return [void]
************************************************************************/
-void GPS_Math_XYZ_To_Airy1830LatLonH(double *phi, double *lambda, double *H,
+void GPS_Math_XYZ_To_Airy1830LatLonH(double* phi, double* lambda, double* H,
double x, double y, double z)
{
double a = 6377563.396;
**
** @return [void]
************************************************************************/
-void GPS_Math_XYZ_To_WGS84LatLonH(double *phi, double *lambda, double *H,
+void GPS_Math_XYZ_To_WGS84LatLonH(double* phi, double* lambda, double* H,
double x, double y, double z)
{
double a = 6378137.000;
**
** @return [void]
************************************************************************/
-void GPS_Math_LatLon_To_EN(double *E, double *N, double phi,
+void GPS_Math_LatLon_To_EN(double* E, double* N, double phi,
double lambda, double N0, double E0,
double phi0, double lambda0,
double F0, double a, double b)
**
** @return [void]
************************************************************************/
-void GPS_Math_Airy1830M_LatLonToINGEN(double phi, double lambda, double *E,
- double *N)
+void GPS_Math_Airy1830M_LatLonToINGEN(double phi, double lambda, double* E,
+ double* N)
{
double N0 = 250000;
double E0 = 200000;
**
** @return [void]
************************************************************************/
-void GPS_Math_Airy1830LatLonToNGEN(double phi, double lambda, double *E,
- double *N)
+void GPS_Math_Airy1830LatLonToNGEN(double phi, double lambda, double* E,
+ double* N)
{
double N0 = -100000;
double E0 = 400000;
** @return [void]
************************************************************************/
-int32 GPS_Math_WGS84_To_Swiss_EN(double lat, double lon, double *E,
- double *N)
+int32 GPS_Math_WGS84_To_Swiss_EN(double lat, double lon, double* E,
+ double* N)
{
const double phi0 = 46.95240556;
const double lambda0 = 7.43958333;
**
** @return [void]
************************************************************************/
-void GPS_Math_Swiss_EN_To_WGS84(double E, double N, double *lat, double *lon)
+void GPS_Math_Swiss_EN_To_WGS84(double E, double N, double* lat, double* lon)
{
const double phi0 = 46.95240556;
const double lambda0 = 7.43958333;
**
** @return [void]
************************************************************************/
-void GPS_Math_Cassini_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double M0,
+void GPS_Math_Cassini_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double M0,
double E0, double N0, double a, double b)
{
double p2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Cassini_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double M0,
+void GPS_Math_Cassini_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double M0,
double E0, double N0, double a, double b)
{
** @return [void]
************************************************************************/
-int32 GPS_Math_WGS84_To_ICS_EN(double lat, double lon, double *E,
- double *N)
+int32 GPS_Math_WGS84_To_ICS_EN(double lat, double lon, double* E,
+ double* N)
{
double const phi0 = 31.73409694444; // 31 44 2.749
double const lambda0 = 35.21208055556; // 35 12 43.49
**
** @return [void]
************************************************************************/
-void GPS_Math_ICS_EN_To_WGS84(double E, double N, double *lat, double *lon)
+void GPS_Math_ICS_EN_To_WGS84(double E, double N, double* lat, double* lon)
{
double const phi0 = 31.73409694444; // 31 44 2.749
double const lambda0 = 35.21208055556; // 35 12 43.49
**
** @return [void]
************************************************************************/
-void GPS_Math_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double N0, double E0,
+void GPS_Math_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double N0, double E0,
double phi0, double lambda0,
double F0, double a, double b)
{
**
** @return [void]
************************************************************************/
-void GPS_Math_NGENToAiry1830LatLon(double E, double N, double *phi,
- double *lambda)
+void GPS_Math_NGENToAiry1830LatLon(double E, double N, double* phi,
+ double* lambda)
{
double N0 = -100000;
double E0 = 400000;
**
** @return [void]
************************************************************************/
-void GPS_Math_INGENToAiry1830MLatLon(double E, double N, double *phi,
- double *lambda)
+void GPS_Math_INGENToAiry1830MLatLon(double E, double N, double* phi,
+ double* lambda)
{
double N0 = 250000;
double E0 = 200000;
**
** @return [int32] success
************************************************************************/
-int32 GPS_Math_EN_To_UKOSNG_Map(double E, double N, double *mE,
- double *mN, char *map)
+int32 GPS_Math_EN_To_UKOSNG_Map(double E, double N, double* mE,
+ double* mN, char* map)
{
int32 t;
int32 idx;
**
** @return [int32] success
************************************************************************/
-int32 GPS_Math_UKOSNG_Map_To_EN(char *map, double mapE, double mapN, double *E,
- double *N)
+int32 GPS_Math_UKOSNG_Map_To_EN(char* map, double mapE, double mapN, double* E,
+ double* N)
{
int32 t;
int32 idx;
** @return [void]
************************************************************************/
void GPS_Math_Molodensky(double Sphi, double Slam, double SH, double Sa,
- double Sif, double *Dphi, double *Dlam,
- double *DH, double Da, double Dif, double dx,
+ double Sif, double* Dphi, double* Dlam,
+ double* DH, double Da, double Dif, double dx,
double dy, double dz)
{
double Sf;
** @return [void]
************************************************************************/
void GPS_Math_Known_Datum_To_WGS84_M(double Sphi, double Slam, double SH,
- double *Dphi, double *Dlam, double *DH,
+ double* Dphi, double* Dlam, double* DH,
int32 n)
{
double Sa;
** @return [void]
************************************************************************/
void GPS_Math_WGS84_To_Known_Datum_M(double Sphi, double Slam, double SH,
- double *Dphi, double *Dlam, double *DH,
+ double* Dphi, double* Dlam, double* DH,
int32 n)
{
double Sa;
** @return [void]
************************************************************************/
void GPS_Math_Known_Datum_To_WGS84_C(double Sphi, double Slam, double SH,
- double *Dphi, double *Dlam, double *DH,
+ double* Dphi, double* Dlam, double* DH,
int32 n)
{
double Sa;
** @return [void]
************************************************************************/
void GPS_Math_WGS84_To_Known_Datum_C(double Sphi, double Slam, double SH,
- double *Dphi, double *Dlam, double *DH,
+ double* Dphi, double* Dlam, double* DH,
int32 n)
{
double Sa;
** @return [void]
************************************************************************/
void GPS_Math_Known_Datum_To_Known_Datum_M(double Sphi, double Slam, double SH,
- double *Dphi, double *Dlam,
- double *DH, int32 n1, int32 n2)
+ double* Dphi, double* Dlam,
+ double* DH, int32 n1, int32 n2)
{
double Sa;
double Sif;
** @return [void]
************************************************************************/
void GPS_Math_Known_Datum_To_Known_Datum_C(double Sphi, double Slam, double SH,
- double *Dphi, double *Dlam,
- double *DH, int32 n1, int32 n2)
+ double* Dphi, double* Dlam,
+ double* DH, int32 n1, int32 n2)
{
double Sa;
double Sif;
**
** @return [int32] success
************************************************************************/
-int32 GPS_Math_WGS84_To_UKOSMap_M(double lat, double lon, double *mE,
- double *mN, char *map)
+int32 GPS_Math_WGS84_To_UKOSMap_M(double lat, double lon, double* mE,
+ double* mN, char* map)
{
double alat;
double alon;
**
** @return [int32] success
************************************************************************/
-int32 GPS_Math_UKOSMap_To_WGS84_M(char *map, double mE, double mN,
- double *lat, double *lon)
+int32 GPS_Math_UKOSMap_To_WGS84_M(char* map, double mE, double mN,
+ double* lat, double* lon)
{
double E;
double N;
**
** @return [int32] success
************************************************************************/
-int32 GPS_Math_WGS84_To_UKOSMap_C(double lat, double lon, double *mE,
- double *mN, char *map)
+int32 GPS_Math_WGS84_To_UKOSMap_C(double lat, double lon, double* mE,
+ double* mN, char* map)
{
double alat;
double alon;
**
** @return [int32] success
************************************************************************/
-int32 GPS_Math_UKOSMap_To_WGS84_C(char *map, double mE, double mN,
- double *lat, double *lon)
+int32 GPS_Math_UKOSMap_To_WGS84_C(char* map, double mE, double mN,
+ double* lat, double* lon)
{
double E;
double N;
**
** @return [int32] success
************************************************************************/
-static int32 GPS_Math_LatLon_To_UTM_Param(double lat, double lon, int32 *zone,
- char *zc, double *Mc, double *E0,
- double *N0, double *F0)
+static int32 GPS_Math_LatLon_To_UTM_Param(double lat, double lon, int32* zone,
+ char* zc, double* Mc, double* E0,
+ double* N0, double* F0)
{
int32 ilon;
int32 ilat;
**
** @return [int32] success
************************************************************************/
-int32 GPS_Math_NAD83_To_UTM_EN(double lat, double lon, double *E,
- double *N, int32 *zone, char *zc)
+int32 GPS_Math_NAD83_To_UTM_EN(double lat, double lon, double* E,
+ double* N, int32* zone, char* zc)
{
double phi0;
double lambda0;
**
** @return [int32] success
************************************************************************/
-int32 GPS_Math_WGS84_To_UTM_EN(double lat, double lon, double *E,
- double *N, int32 *zone, char *zc)
+int32 GPS_Math_WGS84_To_UTM_EN(double lat, double lon, double* E,
+ double* N, int32* zone, char* zc)
{
double phi;
double lambda;
**
** @return [int32] success
************************************************************************/
-static int32 GPS_Math_UTM_Param_To_Mc(int32 zone, char zc, double *Mc,
- double *E0, double *N0, double *F0)
+static int32 GPS_Math_UTM_Param_To_Mc(int32 zone, char zc, double* Mc,
+ double* E0, double* N0, double* F0)
{
if (zone>60 || zone<0 || zc<'C' || zc>'X') {
**
** @return [int32] success
************************************************************************/
-int32 GPS_Math_UTM_EN_To_NAD83(double *lat, double *lon, double E,
+int32 GPS_Math_UTM_EN_To_NAD83(double* lat, double* lon, double E,
double N, int32 zone, char zc)
{
return GPS_Math_UTM_EN_To_Known_Datum(lat, lon, E, N, zone, zc, 77);
**
** @return [int32] success
************************************************************************/
-int32 GPS_Math_UTM_EN_To_WGS84(double *lat, double *lon, double E,
+int32 GPS_Math_UTM_EN_To_WGS84(double* lat, double* lon, double E,
double N, int32 zone, char zc)
{
double lambda0;
**
** @return [int32] success
************************************************************************/
-int32 GPS_Math_Known_Datum_To_UTM_EN(double lat, double lon, double *E,
- double *N, int32 *zone, char *zc, const int n)
+int32 GPS_Math_Known_Datum_To_UTM_EN(double lat, double lon, double* E,
+ double* N, int32* zone, char* zc, const int n)
{
double phi0;
double lambda0;
**
** @return [int32] success
************************************************************************/
-int32 GPS_Math_UTM_EN_To_Known_Datum(double *lat, double *lon, double E,
+int32 GPS_Math_UTM_EN_To_Known_Datum(double* lat, double* lon, double E,
double N, int32 zone, char zc, const int n)
{
double lambda0;
**
** @return [void]
***************************************************************************/
-void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double *E,
- double *N,double phi0,double lambda0,
+void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N,double phi0,double lambda0,
double E0, double N0, double a, double b)
{
** @return [void]
*************************************************************************/
-void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double lambda0,
+void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double lambda0,
double E0, double N0, double a, double b)
{
double a2;
void GPS_Math_UTM_EN_to_LatLon(int ReferenceEllipsoid,
const double UTMNorthing, const double UTMEasting,
- double *Lat, double *Lon,
+ double* Lat, double* Lon,
const double lambda0,
const double E0,
const double N0)
/********************************************************************/
-int32 GPS_Lookup_Datum_Index(const char *n)
+int32 GPS_Lookup_Datum_Index(const char* n)
{
GPS_PDatum dp;
GPS_PDatum_Alias al;
return -1;
}
-char *
+char*
GPS_Math_Get_Datum_Name(const int datum_index)
{
return GPS_Datum[datum_index].name;
time_t GPS_Math_Utime_To_Gtime(time_t v);
time_t GPS_Math_Gtime_To_Utime(time_t v);
- void GPS_Math_Deg_To_DegMin(double v, int32 *d, double *m);
- void GPS_Math_DegMin_To_Deg(int32 d, double m, double *deg);
- void GPS_Math_Deg_To_DegMinSec(double v, int32 *d, int32 *m, double *s);
- void GPS_Math_DegMinSec_To_Deg(int32 d, int32 m, double s, double *deg);
+ void GPS_Math_Deg_To_DegMin(double v, int32* d, double* m);
+ void GPS_Math_DegMin_To_Deg(int32 d, double m, double* deg);
+ void GPS_Math_Deg_To_DegMinSec(double v, int32* d, int32* m, double* s);
+ void GPS_Math_DegMinSec_To_Deg(int32 d, int32 m, double s, double* deg);
- void GPS_Math_Airy1830LatLonToNGEN(double phi, double lambda, double *E,
- double *N);
- void GPS_Math_Airy1830M_LatLonToINGEN(double phi, double lambda, double *E,
- double *N);
- int32 GPS_Math_EN_To_UKOSNG_Map(double E, double N, double *mE,
- double *mN, char *map);
- int32 GPS_Math_UKOSNG_Map_To_EN(char *map, double mapE, double mapN,
- double *E, double *N);
+ void GPS_Math_Airy1830LatLonToNGEN(double phi, double lambda, double* E,
+ double* N);
+ void GPS_Math_Airy1830M_LatLonToINGEN(double phi, double lambda, double* E,
+ double* N);
+ int32 GPS_Math_EN_To_UKOSNG_Map(double E, double N, double* mE,
+ double* mN, char* map);
+ int32 GPS_Math_UKOSNG_Map_To_EN(char* map, double mapE, double mapN,
+ double* E, double* N);
void GPS_Math_LatLonH_To_XYZ(double phi, double lambda, double H,
- double *x, double *y, double *z,
+ double* x, double* y, double* z,
double a, double b);
- void GPS_Math_XYZ_To_LatLonH(double *phi, double *lambda, double *H,
+ void GPS_Math_XYZ_To_LatLonH(double* phi, double* lambda, double* H,
double x, double y, double z,
double a, double b);
- void GPS_Math_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double N0, double E0,
+ void GPS_Math_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double N0, double E0,
double phi0, double lambda0,
double F0, double a, double b);
- void GPS_Math_LatLon_To_EN(double *E, double *N, double phi,
+ void GPS_Math_LatLon_To_EN(double* E, double* N, double phi,
double lambda, double N0, double E0,
double phi0, double lambda0,
double F0, double a, double b);
- void GPS_Math_NGENToAiry1830LatLon(double E, double N, double *phi,
- double *lambda);
- void GPS_Math_INGENToAiry1830MLatLon(double E, double N, double *phi,
- double *lambda);
+ void GPS_Math_NGENToAiry1830LatLon(double E, double N, double* phi,
+ double* lambda);
+ void GPS_Math_INGENToAiry1830MLatLon(double E, double N, double* phi,
+ double* lambda);
void GPS_Math_Airy1830LatLonH_To_XYZ(double phi, double lambda, double H,
- double *x, double *y, double *z);
+ double* x, double* y, double* z);
void GPS_Math_WGS84LatLonH_To_XYZ(double phi, double lambda, double H,
- double *x, double *y, double *z);
- void GPS_Math_XYZ_To_Airy1830LatLonH(double *phi, double *lambda, double *H,
+ double* x, double* y, double* z);
+ void GPS_Math_XYZ_To_Airy1830LatLonH(double* phi, double* lambda, double* H,
double x, double y, double z);
- void GPS_Math_XYZ_To_WGS84LatLonH(double *phi, double *lambda, double *H,
+ void GPS_Math_XYZ_To_WGS84LatLonH(double* phi, double* lambda, double* H,
double x, double y, double z);
void GPS_Math_Molodensky(double Sphi, double Slam, double SH, double Sa,
- double Sif, double *Dphi, double *Dlam,
- double *DH, double Da, double Dif, double dx,
+ double Sif, double* Dphi, double* Dlam,
+ double* DH, double Da, double Dif, double dx,
double dy, double dz);
void GPS_Math_Known_Datum_To_WGS84_M(double Sphi, double Slam, double SH,
- double *Dphi, double *Dlam, double *DH,
+ double* Dphi, double* Dlam, double* DH,
int32 n);
void GPS_Math_WGS84_To_Known_Datum_M(double Sphi, double Slam, double SH,
- double *Dphi, double *Dlam, double *DH,
+ double* Dphi, double* Dlam, double* DH,
int32 n);
void GPS_Math_Known_Datum_To_WGS84_C(double Sphi, double Slam, double SH,
- double *Dphi, double *Dlam, double *DH,
+ double* Dphi, double* Dlam, double* DH,
int32 n);
void GPS_Math_WGS84_To_Known_Datum_C(double Sphi, double Slam, double SH,
- double *Dphi, double *Dlam, double *DH,
+ double* Dphi, double* Dlam, double* DH,
int32 n);
void GPS_Math_Known_Datum_To_Known_Datum_M(double Sphi, double Slam, double SH,
- double *Dphi, double *Dlam,
- double *DH, int32 n1, int32 n2);
+ double* Dphi, double* Dlam,
+ double* DH, int32 n1, int32 n2);
void GPS_Math_Known_Datum_To_Known_Datum_C(double Sphi, double Slam, double SH,
- double *Dphi, double *Dlam,
- double *DH, int32 n1, int32 n2);
+ double* Dphi, double* Dlam,
+ double* DH, int32 n1, int32 n2);
- int32 GPS_Math_WGS84_To_UKOSMap_M(double lat, double lon, double *mE,
- double *mN, char *map);
- int32 GPS_Math_UKOSMap_To_WGS84_M(char *map, double mE, double mN,
- double *lat, double *lon);
- int32 GPS_Math_WGS84_To_UKOSMap_C(double lat, double lon, double *mE,
- double *mN, char *map);
- int32 GPS_Math_UKOSMap_To_WGS84_C(char *map, double mE, double mN,
- double *lat, double *lon);
+ int32 GPS_Math_WGS84_To_UKOSMap_M(double lat, double lon, double* mE,
+ double* mN, char* map);
+ int32 GPS_Math_UKOSMap_To_WGS84_M(char* map, double mE, double mN,
+ double* lat, double* lon);
+ int32 GPS_Math_WGS84_To_UKOSMap_C(double lat, double lon, double* mE,
+ double* mN, char* map);
+ int32 GPS_Math_UKOSMap_To_WGS84_C(char* map, double mE, double mN,
+ double* lat, double* lon);
- int32 GPS_Math_NAD83_To_UTM_EN(double lat, double lon, double *E,
- double *N, int32 *zone, char *zc);
- int32 GPS_Math_WGS84_To_UTM_EN(double lat, double lon, double *E,
- double *N, int32 *zone, char *zc);
+ int32 GPS_Math_NAD83_To_UTM_EN(double lat, double lon, double* E,
+ double* N, int32* zone, char* zc);
+ int32 GPS_Math_WGS84_To_UTM_EN(double lat, double lon, double* E,
+ double* N, int32* zone, char* zc);
- int32 GPS_Math_UTM_EN_To_WGS84(double *lat, double *lon, double E,
+ int32 GPS_Math_UTM_EN_To_WGS84(double* lat, double* lon, double E,
double N, int32 zone, char zc);
- int32 GPS_Math_UTM_EN_To_NAD83(double *lat, double *lon, double E,
+ int32 GPS_Math_UTM_EN_To_NAD83(double* lat, double* lon, double E,
double N, int32 zone, char zc);
- int32 GPS_Math_Known_Datum_To_UTM_EN(double lat, double lon, double *E,
- double *N, int32 *zone, char *zc, const int n);
- int32 GPS_Math_UTM_EN_To_Known_Datum(double *lat, double *lon, double E,
+ int32 GPS_Math_Known_Datum_To_UTM_EN(double lat, double lon, double* E,
+ double* N, int32* zone, char* zc, const int n);
+ int32 GPS_Math_UTM_EN_To_Known_Datum(double* lat, double* lon, double E,
double N, int32 zone, char zc, const int n);
- void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double *E,
- double *N,double phi0,double lambda0,
+ void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N,double phi0,double lambda0,
double E0, double N0, double a, double b);
- void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double lambda0,
+ void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double lambda0,
double E0, double N0, double a, double b);
- int32 GPS_Math_WGS84_To_ICS_EN(double lat, double lon, double *E,
- double *N);
- void GPS_Math_ICS_EN_To_WGS84(double E, double N, double *lat, double *lon);
+ int32 GPS_Math_WGS84_To_ICS_EN(double lat, double lon, double* E,
+ double* N);
+ void GPS_Math_ICS_EN_To_WGS84(double E, double N, double* lat, double* lon);
- int32 GPS_Math_WGS84_To_Swiss_EN(double phi, double lambda, double *E, double *N);
- void GPS_Math_Swiss_EN_To_WGS84(double E, double N, double *lat, double *lon);
+ int32 GPS_Math_WGS84_To_Swiss_EN(double phi, double lambda, double* E, double* N);
+ void GPS_Math_Swiss_EN_To_WGS84(double E, double N, double* lat, double* lon);
void GPS_Math_UTM_EN_to_LatLon(int ReferenceEllipsoid,
const double UTMNorthing, const double UTMEasting,
- double *Lat, double *Lon,
+ double* Lat, double* Lon,
const double lambda0, const double E0, const double N0);
- int32 GPS_Lookup_Datum_Index(const char *n);
- char *GPS_Math_Get_Datum_Name(const int datum_index);
+ int32 GPS_Lookup_Datum_Index(const char* n);
+ char* GPS_Math_Get_Datum_Name(const int datum_index);
#endif
fflush(stderr);
return NULL;
}
- if (!(ret->data = (UC *)calloc(1, MAX_GPS_PACKET_SIZE*sizeof(UC)))) {
+ if (!(ret->data = (UC*)calloc(1, MAX_GPS_PACKET_SIZE*sizeof(UC)))) {
perror("malloc");
fprintf(stderr,"GPS_Packet_New: Insufficient data memory");
fflush(stderr);
** @return [void]
**********************************************************************/
-void GPS_Packet_Del(GPS_PPacket *thys)
+void GPS_Packet_Del(GPS_PPacket* thys)
{
- free((void *)(*thys)->data);
- free((void *)*thys);
+ free((void*)(*thys)->data);
+ free((void*)*thys);
return;
}
** @return [void]
**********************************************************************/
-void GPS_Pvt_Del(GPS_PPvt_Data *thys)
+void GPS_Pvt_Del(GPS_PPvt_Data* thys)
{
- free((void *)*thys);
+ free((void*)*thys);
return;
}
** @return [void]
**********************************************************************/
-void GPS_Almanac_Del(GPS_PAlmanac *thys)
+void GPS_Almanac_Del(GPS_PAlmanac* thys)
{
- free((void *)*thys);
+ free((void*)*thys);
return;
}
** @return [void]
**********************************************************************/
-void GPS_Track_Del(GPS_PTrack *thys)
+void GPS_Track_Del(GPS_PTrack* thys)
{
- free((void *)*thys);
+ free((void*)*thys);
return;
}
** @return [void]
**********************************************************************/
-void GPS_Way_Del(GPS_PWay *thys)
+void GPS_Way_Del(GPS_PWay* thys)
{
- xfree((void *)*thys);
+ xfree((void*)*thys);
return;
}
** @return [void]
**********************************************************************/
-void GPS_Lap_Del(GPS_PLap *thys)
+void GPS_Lap_Del(GPS_PLap* thys)
{
- free((void *)*thys);
+ free((void*)*thys);
return;
}
**
** @return [void]
**********************************************************************/
-void GPS_Course_Del(GPS_PCourse *thys)
+void GPS_Course_Del(GPS_PCourse* thys)
{
- free((void *)*thys);
+ free((void*)*thys);
return;
}
** @return [void]
**********************************************************************/
-void GPS_Course_Lap_Del(GPS_PCourse_Lap *thys)
+void GPS_Course_Lap_Del(GPS_PCourse_Lap* thys)
{
- free((void *)*thys);
+ free((void*)*thys);
return;
}
** @return [void]
**********************************************************************/
-void GPS_Course_Point_Del(GPS_PCourse_Point *thys)
+void GPS_Course_Point_Del(GPS_PCourse_Point* thys)
{
- free((void *)*thys);
+ free((void*)*thys);
return;
}
#include "gps.h"
GPS_PPacket GPS_Packet_New(void);
- void GPS_Packet_Del(GPS_PPacket *thys);
+ void GPS_Packet_Del(GPS_PPacket* thys);
GPS_PPvt_Data GPS_Pvt_New(void);
- void GPS_Pvt_Del(GPS_PPvt_Data *thys);
+ void GPS_Pvt_Del(GPS_PPvt_Data* thys);
GPS_PAlmanac GPS_Almanac_New(void);
- void GPS_Almanac_Del(GPS_PAlmanac *thys);
+ void GPS_Almanac_Del(GPS_PAlmanac* thys);
GPS_PTrack GPS_Track_New(void);
- void GPS_Track_Del(GPS_PTrack *thys);
+ void GPS_Track_Del(GPS_PTrack* thys);
GPS_PWay GPS_Way_New(void);
- void GPS_Way_Del(GPS_PWay *thys);
+ void GPS_Way_Del(GPS_PWay* thys);
GPS_PLap GPS_Lap_New(void);
- void GPS_Lap_Del(GPS_PLap *thys);
+ void GPS_Lap_Del(GPS_PLap* thys);
GPS_PCourse GPS_Course_New(void);
- void GPS_Course_Del(GPS_PCourse *thys);
+ void GPS_Course_Del(GPS_PCourse* thys);
GPS_PCourse_Lap GPS_Course_Lap_New(void);
- void GPS_Course_Lap_Del(GPS_PCourse_Lap *thys);
+ void GPS_Course_Lap_Del(GPS_PCourse_Lap* thys);
GPS_PCourse_Point GPS_Course_Point_New(void);
- void GPS_Course_Point_Del(GPS_PCourse_Point *thys);
+ void GPS_Course_Point_Del(GPS_PCourse_Point* thys);
#endif
**
** @return [void]
************************************************************************/
-void GPS_Math_Albers_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi1, double phi2,
+void GPS_Math_Albers_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi1, double phi2,
double phi0, double M0, double E0,
double N0, double a, double b)
**
** @return [void]
************************************************************************/
-void GPS_Math_Albers_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi1, double phi2,
+void GPS_Math_Albers_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi1, double phi2,
double phi0, double M0, double E0,
double N0, double a, double b)
{
**
** @return [void]
************************************************************************/
-void GPS_Math_LambertCC_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi1, double phi2,
+void GPS_Math_LambertCC_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi1, double phi2,
double phi0, double M0, double E0,
double N0, double a, double b)
**
** @return [void]
************************************************************************/
-void GPS_Math_LambertCC_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi1, double phi2,
+void GPS_Math_LambertCC_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi1, double phi2,
double phi0, double M0, double E0,
double N0, double a, double b)
{
**
** @return [void]
************************************************************************/
-void GPS_Math_Miller_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double M0, double E0,
+void GPS_Math_Miller_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double M0, double E0,
double N0, double a, double b)
{
double a2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Miller_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double M0, double E0,
+void GPS_Math_Miller_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double M0, double E0,
double N0, double a, double b)
{
double a2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Bonne_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double M0, double E0,
+void GPS_Math_Bonne_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double M0, double E0,
double N0, double a, double b)
{
double p2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Bonne_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double M0,
+void GPS_Math_Bonne_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double M0,
double E0, double N0, double a, double b)
{
double p2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Cassini_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double M0,
+void GPS_Math_Cassini_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double M0,
double E0, double N0, double a, double b)
{
double p2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Cassini_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double M0,
+void GPS_Math_Cassini_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double M0,
double E0, double N0, double a, double b)
{
**
** @return [void]
************************************************************************/
-void GPS_Math_Cylea_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double M0,
+void GPS_Math_Cylea_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double M0,
double E0, double N0, double a, double b)
{
double a2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Cylea_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double M0,
+void GPS_Math_Cylea_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double M0,
double E0, double N0, double a, double b)
{
**
** @return [void]
************************************************************************/
-void GPS_Math_EckertIV_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double M0, double E0, double N0,
+void GPS_Math_EckertIV_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double M0, double E0, double N0,
double a, double b)
{
double a2;
**
** @return [void]
************************************************************************/
-void GPS_Math_EckertIV_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double M0, double E0,
+void GPS_Math_EckertIV_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double M0, double E0,
double N0, double a, double b)
{
double a2;
**
** @return [void]
************************************************************************/
-void GPS_Math_EckertVI_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double M0, double E0, double N0,
+void GPS_Math_EckertVI_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double M0, double E0, double N0,
double a, double b)
{
double a2;
**
** @return [void]
************************************************************************/
-void GPS_Math_EckertVI_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double M0, double E0,
+void GPS_Math_EckertVI_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double M0, double E0,
double N0, double a, double b)
{
double a2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Cyled_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double M0, double E0,
+void GPS_Math_Cyled_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double M0, double E0,
double N0, double a, double b)
{
double p2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Cyled_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double M0,
+void GPS_Math_Cyled_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double M0,
double E0, double N0, double a, double b)
{
double p2;
**
** @return [void]
************************************************************************/
-void GPS_Math_VderGrinten_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double M0, double E0,
+void GPS_Math_VderGrinten_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double M0, double E0,
double N0, double a, double b)
{
double po2;
**
** @return [void]
************************************************************************/
-void GPS_Math_VderGrinten_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double M0, double E0,
+void GPS_Math_VderGrinten_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double M0, double E0,
double N0, double a, double b)
{
double po2;
**
** @return [void]
************************************************************************/
-void GPS_Math_PolarSt_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi1, double lambda1,
+void GPS_Math_PolarSt_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi1, double lambda1,
double E0, double N0, double a, double b)
{
double p2;
**
** @return [void]
************************************************************************/
-void GPS_Math_PolarSt_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi1, double lambda1,
+void GPS_Math_PolarSt_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi1, double lambda1,
double E0, double N0, double a, double b)
{
double p2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Mollweide_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double M0, double E0,
+void GPS_Math_Mollweide_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double M0, double E0,
double N0, double a, double b)
{
double a2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Mollweide_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double M0, double E0,
+void GPS_Math_Mollweide_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double M0, double E0,
double N0, double a, double b)
{
double a2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Orthog_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double lambda0,
+void GPS_Math_Orthog_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double lambda0,
double E0, double N0, double a, double b)
{
double p2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Orthog_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double lambda0,
+void GPS_Math_Orthog_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double lambda0,
double E0, double N0, double a, double b)
{
double p2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Polycon_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double M0,
+void GPS_Math_Polycon_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double M0,
double E0, double N0, double a, double b)
{
double p2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Polycon_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double M0,
+void GPS_Math_Polycon_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double M0,
double E0, double N0, double a, double b)
{
double p2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Sinusoid_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double M0, double E0,
+void GPS_Math_Sinusoid_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double M0, double E0,
double N0, double a, double b)
{
double a2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Sinusoid_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double M0, double E0,
+void GPS_Math_Sinusoid_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double M0, double E0,
double N0, double a, double b)
{
double a2;
**
** @return [void]
************************************************************************/
-void GPS_Math_TCylEA_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double M0, double E0,
+void GPS_Math_TCylEA_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double M0, double E0,
double N0, double a, double b)
{
double p2;
**
** @return [void]
************************************************************************/
-void GPS_Math_TCylEA_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double M0,
+void GPS_Math_TCylEA_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double M0,
double E0, double N0, double a, double b)
{
double p2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Mercator_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double lambda0,
+void GPS_Math_Mercator_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double lambda0,
double E0, double N0, double a, double b)
{
double p2;
**
** @return [void]
************************************************************************/
-void GPS_Math_Mercator_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0,
+void GPS_Math_Mercator_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0,
double lambda0, double E0, double N0,
double a, double b)
{
**
** @return [void]
************************************************************************/
-void GPS_Math_TMerc_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double lambda0,
+void GPS_Math_TMerc_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double lambda0,
double E0, double N0, double F0,
double a, double b)
{
**
** @return [void]
************************************************************************/
-void GPS_Math_TMerc_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double lambda0,
+void GPS_Math_TMerc_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double lambda0,
double E0, double N0, double F0,
double a, double b)
{
**
** @return [void]
***************************************************************************/
-void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double *E,
- double *N,double phi0,double lambda0,
+void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N,double phi0,double lambda0,
double E0, double N0, double a, double b)
{
** @return [void]
*************************************************************************/
-void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double lambda0,
+void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double lambda0,
double E0, double N0, double a, double b)
{
double a2;
#include "gps.h"
- void GPS_Math_Albers_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi1, double phi2,
+ void GPS_Math_Albers_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi1, double phi2,
double phi0, double M0, double E0,
double N0, double a, double b);
- void GPS_Math_Albers_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi1, double phi2,
+ void GPS_Math_Albers_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi1, double phi2,
double phi0, double M0, double E0,
double N0, double a, double b);
- void GPS_Math_LambertCC_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi1, double phi2,
+ void GPS_Math_LambertCC_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi1, double phi2,
double phi0, double M0, double E0,
double N0, double a, double b);
- void GPS_Math_LambertCC_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi1, double phi2,
+ void GPS_Math_LambertCC_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi1, double phi2,
double phi0, double M0, double E0,
double N0, double a, double b);
- void GPS_Math_Miller_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double M0, double E0,
+ void GPS_Math_Miller_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double M0, double E0,
double N0, double a, double b);
- void GPS_Math_Miller_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double M0, double E0,
+ void GPS_Math_Miller_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double M0, double E0,
double N0, double a, double b);
- void GPS_Math_Bonne_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double M0, double E0,
+ void GPS_Math_Bonne_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double M0, double E0,
double N0, double a, double b);
- void GPS_Math_Bonne_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double M0,
+ void GPS_Math_Bonne_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double M0,
double E0, double N0, double a, double b);
- void GPS_Math_Cassini_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double M0,
+ void GPS_Math_Cassini_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double M0,
double E0, double N0, double a, double b);
- void GPS_Math_Cassini_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double M0,
+ void GPS_Math_Cassini_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double M0,
double E0, double N0, double a, double b);
- void GPS_Math_Cylea_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double M0,
+ void GPS_Math_Cylea_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double M0,
double E0, double N0, double a, double b);
- void GPS_Math_Cylea_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double M0,
+ void GPS_Math_Cylea_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double M0,
double E0, double N0, double a, double b);
- void GPS_Math_EckertIV_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double M0, double E0, double N0,
+ void GPS_Math_EckertIV_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double M0, double E0, double N0,
double a, double b);
- void GPS_Math_EckertIV_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double M0, double E0,
+ void GPS_Math_EckertIV_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double M0, double E0,
double N0, double a, double b);
- void GPS_Math_EckertVI_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double M0, double E0, double N0,
+ void GPS_Math_EckertVI_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double M0, double E0, double N0,
double a, double b);
- void GPS_Math_EckertVI_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double M0, double E0,
+ void GPS_Math_EckertVI_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double M0, double E0,
double N0, double a, double b);
- void GPS_Math_Cyled_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double M0, double E0,
+ void GPS_Math_Cyled_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double M0, double E0,
double N0, double a, double b);
- void GPS_Math_Cyled_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double M0,
+ void GPS_Math_Cyled_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double M0,
double E0, double N0, double a, double b);
- void GPS_Math_VderGrinten_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double M0, double E0,
+ void GPS_Math_VderGrinten_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double M0, double E0,
double N0, double a, double b);
- void GPS_Math_VderGrinten_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double M0, double E0,
+ void GPS_Math_VderGrinten_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double M0, double E0,
double N0, double a, double b);
- void GPS_Math_PolarSt_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi1, double lambda1,
+ void GPS_Math_PolarSt_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi1, double lambda1,
double E0, double N0, double a, double b);
- void GPS_Math_PolarSt_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi1, double lambda1,
+ void GPS_Math_PolarSt_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi1, double lambda1,
double E0, double N0, double a, double b);
- void GPS_Math_Mollweide_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double M0, double E0,
+ void GPS_Math_Mollweide_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double M0, double E0,
double N0, double a, double b);
- void GPS_Math_Mollweide_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double M0, double E0,
+ void GPS_Math_Mollweide_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double M0, double E0,
double N0, double a, double b);
- void GPS_Math_Orthog_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double lambda0,
+ void GPS_Math_Orthog_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double lambda0,
double E0, double N0, double a, double b);
- void GPS_Math_Orthog_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double lambda0,
+ void GPS_Math_Orthog_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double lambda0,
double E0, double N0, double a, double b);
- void GPS_Math_Polycon_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double M0,
+ void GPS_Math_Polycon_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double M0,
double E0, double N0, double a, double b);
- void GPS_Math_Polycon_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double M0,
+ void GPS_Math_Polycon_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double M0,
double E0, double N0, double a, double b);
- void GPS_Math_Sinusoid_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double M0, double E0,
+ void GPS_Math_Sinusoid_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double M0, double E0,
double N0, double a, double b);
- void GPS_Math_Sinusoid_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double M0, double E0,
+ void GPS_Math_Sinusoid_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double M0, double E0,
double N0, double a, double b);
- void GPS_Math_TCylEA_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double M0, double E0,
+ void GPS_Math_TCylEA_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double M0, double E0,
double N0, double a, double b);
- void GPS_Math_TCylEA_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double M0,
+ void GPS_Math_TCylEA_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double M0,
double E0, double N0, double a, double b);
- void GPS_Math_Mercator_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double lambda0,
+ void GPS_Math_Mercator_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double lambda0,
double E0, double N0, double a, double b);
- void GPS_Math_Mercator_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0,
+ void GPS_Math_Mercator_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0,
double lambda0, double E0, double N0,
double a, double b);
- void GPS_Math_TMerc_LatLon_To_EN(double phi, double lambda, double *E,
- double *N, double phi0, double lambda0,
+ void GPS_Math_TMerc_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N, double phi0, double lambda0,
double E0, double N0, double F0,
double a, double b);
- void GPS_Math_TMerc_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double lambda0,
+ void GPS_Math_TMerc_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double lambda0,
double E0, double N0, double F0,
double a, double b);
- void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double *E,
- double *N,double phi0,double lambda0,
+ void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double* E,
+ double* N,double phi0,double lambda0,
double E0, double N0, double a, double b);
- void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double *phi,
- double *lambda, double phi0, double lambda0,
+ void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double* phi,
+ double* lambda, double phi0, double lambda0,
double E0, double N0, double a, double b);
#endif
** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
** Boston, MA 02111-1307, USA.
********************************************************************/
-#define COMMON
+#define COMMON
#include "gps.h"
#include <stdio.h>
** @return [int32] number of bytes read
**********************************************************************/
-int32 GPS_Serial_Packet_Read(gpsdevh *fd, GPS_PPacket *packet)
+int32 GPS_Serial_Packet_Read(gpsdevh* fd, GPS_PPacket* packet)
{
time_t start;
int32 n;
int32 len;
UC u;
int32 isDLE;
- UC *p;
+ UC* p;
int32 i;
UC chk=0, chk_read;
- const char *m1;
- const char *m2;
+ const char* m1;
+ const char* m2;
len = 0;
isDLE = gpsFalse;
** @return [int32] true if ACK
**********************************************************************/
-int32 GPS_Serial_Get_Ack(gpsdevh *fd, GPS_PPacket *tra, GPS_PPacket *rec)
+int32 GPS_Serial_Get_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec)
{
if (!GPS_Serial_Packet_Read(fd, rec)) {
return 0;
#include "gps.h"
time_t GPS_Time_Now(void);
- int32 GPS_Serial_Packet_Read(gpsdevh *fd, GPS_PPacket *packet);
- int32 GPS_Serial_Get_Ack(gpsdevh *fd, GPS_PPacket *tra, GPS_PPacket *rec);
+ int32 GPS_Serial_Packet_Read(gpsdevh* fd, GPS_PPacket* packet);
+ int32 GPS_Serial_Get_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec);
#endif
#include "gps.h"
-static int32 GPS_A600_Rqst(gpsdevh *fd, time_t Time);
-static int32 GPS_A700_Rqst(gpsdevh *fd, double lat, double lon);
+static int32 GPS_A600_Rqst(gpsdevh* fd, time_t Time);
+static int32 GPS_A700_Rqst(gpsdevh* fd, double lat, double lon);
** @return [int32] true if OK
************************************************************************/
-int32 GPS_Rqst_Send_Time(gpsdevh *fd, time_t Time)
+int32 GPS_Rqst_Send_Time(gpsdevh* fd, time_t Time)
{
time_t ret=0;
**
** @return [int32] success
************************************************************************/
-static int32 GPS_A600_Rqst(gpsdevh *fd, time_t Time)
+static int32 GPS_A600_Rqst(gpsdevh* fd, time_t Time)
{
GPS_PPacket tra;
GPS_PPacket rec;
** @return [int32] success
************************************************************************/
-int32 GPS_Rqst_Send_Position(gpsdevh *fd, double lat, double lon)
+int32 GPS_Rqst_Send_Position(gpsdevh* fd, double lat, double lon)
{
int32 ret=0;
**
** @return [int32] success
************************************************************************/
-static int32 GPS_A700_Rqst(gpsdevh *fd, double lat, double lon)
+static int32 GPS_A700_Rqst(gpsdevh* fd, double lat, double lon)
{
GPS_PPacket tra;
GPS_PPacket rec;
#include "gps.h"
- int32 GPS_Rqst_Send_Time(gpsdevh *fd, time_t Time);
- int32 GPS_Rqst_Send_Position(gpsdevh *fd, double lat, double lon);
+ int32 GPS_Rqst_Send_Time(gpsdevh* fd, time_t Time);
+ int32 GPS_Rqst_Send_Position(gpsdevh* fd, double lat, double lon);
#endif
static US
Build_Serial_Packet(GPS_PPacket in, GPS_Serial_PPacket out)
{
- UC *p;
- UC *q;
+ UC* p;
+ UC* q;
int32 i;
UC chk=0;
void
-Diag(void *buf, size_t sz)
+Diag(void* buf, size_t sz)
{
- unsigned char *cbuf = (unsigned char *) buf;
+ unsigned char* cbuf = (unsigned char*) buf;
while (sz--) {
GPS_Diag("%02x ", *cbuf++);
}
}
void
-DiagS(void *buf, size_t sz)
+DiagS(void* buf, size_t sz)
{
- unsigned char *cbuf = (unsigned char *) buf;
+ unsigned char* cbuf = (unsigned char*) buf;
while (sz--) {
unsigned char c = *cbuf++;
** @return [int32] number of bytes in the packet
************************************************************************/
-int32 GPS_Serial_Write_Packet(gpsdevh *fd, GPS_PPacket packet)
+int32 GPS_Serial_Write_Packet(gpsdevh* fd, GPS_PPacket packet)
{
size_t ret;
- const char *m1, *m2;
+ const char* m1, *m2;
GPS_Serial_OPacket ser_pkt;
UC ser_pkt_data[MAX_GPS_PACKET_SIZE * sizeof(UC)];
US bytes;
GPS_Diag("Tx Data:");
Diag(&ser_pkt.dle, 3);
- if ((ret=GPS_Serial_Write(fd,(const void *) &ser_pkt.dle,(size_t)3)) == -1) {
+ if ((ret=GPS_Serial_Write(fd,(const void*) &ser_pkt.dle,(size_t)3)) == -1) {
perror("write");
GPS_Error("SEND: Write to GPS failed");
return 0;
}
Diag(ser_pkt.data, bytes);
- if ((ret=GPS_Serial_Write(fd,(const void *)ser_pkt.data,(size_t)bytes)) == -1) {
+ if ((ret=GPS_Serial_Write(fd,(const void*)ser_pkt.data,(size_t)bytes)) == -1) {
perror("write");
GPS_Error("SEND: Write to GPS failed");
return 0;
m1 = Get_Pkt_Type(ser_pkt.type, ser_pkt.data[0], &m2);
GPS_Diag("(%-8s%s)\n", m1, m2 ? m2 : "");
- if ((ret=GPS_Serial_Write(fd,(const void *)&ser_pkt.chk,(size_t)3)) == -1) {
+ if ((ret=GPS_Serial_Write(fd,(const void*)&ser_pkt.chk,(size_t)3)) == -1) {
perror("write");
GPS_Error("SEND: Write to GPS failed");
return 0;
** @return [int32] success
************************************************************************/
-int32 GPS_Serial_Send_Ack(gpsdevh *fd, GPS_PPacket *tra, GPS_PPacket *rec)
+int32 GPS_Serial_Send_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec)
{
UC data[2];
#define GPS_ARB_LEN 1024
- int32 GPS_Serial_Write_Packet(gpsdevh *fd, GPS_PPacket packet);
- int32 GPS_Serial_Send_Ack(gpsdevh *fd, GPS_PPacket *tra, GPS_PPacket *rec);
+ int32 GPS_Serial_Write_Packet(gpsdevh* fd, GPS_PPacket packet);
+ int32 GPS_Serial_Send_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec);
- void GPS_Make_Packet(GPS_PPacket *packet, US type, UC *data, uint32 n);
+ void GPS_Make_Packet(GPS_PPacket* packet, US type, UC* data, uint32 n);
#endif
#if 0
#define GARMULATOR 1
-char *rxdata[] = {
+char* rxdata[] = {
"10 06 02 fe 00 fa 10 03",
"10 ff 7d 97 00 0e 01 53 74 72 65 65 74 50 69 6c 6f 74 20 33 20 53 6f 66 74 77 61 72 65 20 56 65 72 73 69 6f 6e 20 32 2e 37 30 00 56 45 52 42 4d 41 50 20 41 6d 65 72 69 63 61 73 20 41 75 74 6f 72 6f 75 74 65 20 31 2e 30 30 00 56 45 52 41 55 44 20 45 6e 67 6c 69 73 68 20 33 2e 30 31 00 56 45 52 53 50 4c 53 43 52 4e 20 53 70 6c 61 73 68 20 53 63 72 65 65 6e 20 4d 69 73 73 69 6e 67 00 f1 10 03",
"10 f8 0e 56 45 52 53 4d 41 50 31 20 4e 6f 6e 65 00 fb 10 03",
/*
* Display an error from the serial subsystem.
*/
-void GPS_Serial_Error(const char *mb, ...)
+void GPS_Serial_Error(const char* mb, ...)
{
va_list ap;
char msg[200];
- char *s;
+ char* s;
int b;
va_start(ap, mb);
GPS_Error(msg);
}
-int32 GPS_Serial_On(const char *port, gpsdevh **dh)
+int32 GPS_Serial_On(const char* port, gpsdevh** dh)
{
DCB tio;
COMMTIMEOUTS timeout;
HANDLE comport;
- const char *xname = fix_win_serial_name(port);
- win_serial_data *wsd = xcalloc(sizeof(win_serial_data), 1);
+ const char* xname = fix_win_serial_name(port);
+ win_serial_data* wsd = xcalloc(sizeof(win_serial_data), 1);
*dh = (gpsdevh*) wsd;
GPS_Diag("Opening %s\n", xname);
comport = CreateFileA(xname, GENERIC_READ|GENERIC_WRITE, 0, NULL,
return 1;
}
-int32 GPS_Serial_Off(gpsdevh *dh)
+int32 GPS_Serial_Off(gpsdevh* dh)
{
- win_serial_data *wsd = (win_serial_data*)dh;
+ win_serial_data* wsd = (win_serial_data*)dh;
CloseHandle(wsd->comport);
wsd->comport = INVALID_HANDLE_VALUE;
xfree(wsd);
return 1;
}
-int32 GPS_Serial_Chars_Ready(gpsdevh *dh)
+int32 GPS_Serial_Chars_Ready(gpsdevh* dh)
{
COMSTAT lpStat;
DWORD lpErrors;
- win_serial_data *wsd = (win_serial_data*)dh;
+ win_serial_data* wsd = (win_serial_data*)dh;
ClearCommError(wsd->comport, &lpErrors, &lpStat);
return (lpStat.cbInQue > 0);
}
-int32 GPS_Serial_Wait(gpsdevh *fd)
+int32 GPS_Serial_Wait(gpsdevh* fd)
{
/* Wait a short time before testing if data is ready.
* The GPS II, in particular, has a noticable time responding
return GPS_Serial_Chars_Ready(fd);
}
-int32 GPS_Serial_Flush(gpsdevh *fd)
+int32 GPS_Serial_Flush(gpsdevh* fd)
{
return 1;
}
-int32 GPS_Serial_Write(gpsdevh *dh, const void *obuf, int size)
+int32 GPS_Serial_Write(gpsdevh* dh, const void* obuf, int size)
{
- win_serial_data *wsd = (win_serial_data*)dh;
+ win_serial_data* wsd = (win_serial_data*)dh;
DWORD len;
/*
return len;
}
-int32 GPS_Serial_Read(gpsdevh * dh, void *ibuf, int size)
+int32 GPS_Serial_Read(gpsdevh* dh, void* ibuf, int size)
{
DWORD cnt = 0;
- win_serial_data *wsd = (win_serial_data*)dh;
+ win_serial_data* wsd = (win_serial_data*)dh;
ReadFile(wsd->comport, ibuf, size, &cnt, NULL);
return cnt;
** @return [int32] false upon error
************************************************************************/
-int32 GPS_Serial_Open(gpsdevh *dh, const char *port)
+int32 GPS_Serial_Open(gpsdevh* dh, const char* port)
{
struct termios tty;
- posix_serial_data *psd = (posix_serial_data *)dh;
+ posix_serial_data* psd = (posix_serial_data*)dh;
/*
* This originally had O_NDELAY | O_NOCTTY in here, but this
/*
* Display an error from the serial subsystem.
*/
-void GPS_Serial_Error(const char *mb, ...)
+void GPS_Serial_Error(const char* mb, ...)
{
va_list ap;
char msg[200];
- char *s;
+ char* s;
int b;
va_start(ap, mb);
GPS_Error(msg);
}
-int32 GPS_Serial_Read(gpsdevh *dh, void *ibuf, int size)
+int32 GPS_Serial_Read(gpsdevh* dh, void* ibuf, int size)
{
- posix_serial_data *psd = (posix_serial_data *)dh;
+ posix_serial_data* psd = (posix_serial_data*)dh;
#if GARMULATOR
static int l;
- static char *rp;
- char **rxp = &rxdata[l];
- char *hex;
- char *rx = *rxp;
- char *ib = ibuf;
+ static char* rp;
+ char** rxp = &rxdata[l];
+ char* hex;
+ char* rx = *rxp;
+ char* ib = ibuf;
if (!rp) {
rp = rxdata[0];
#endif
}
-int32 GPS_Serial_Write(gpsdevh *dh, const void *obuf, int size)
+int32 GPS_Serial_Write(gpsdevh* dh, const void* obuf, int size)
{
- posix_serial_data *psd = (posix_serial_data *)dh;
+ posix_serial_data* psd = (posix_serial_data*)dh;
return write(psd->fd, obuf, size);
}
**
** @return [int32] false upon error
************************************************************************/
-int32 GPS_Serial_Flush(gpsdevh *fd)
+int32 GPS_Serial_Flush(gpsdevh* fd)
{
- posix_serial_data *psd = (posix_serial_data *)fd;
+ posix_serial_data* psd = (posix_serial_data*)fd;
if (tcflush(psd->fd,TCIOFLUSH)) {
GPS_Serial_Error("SERIAL: tcflush error");
** @return [int32] false upon error
************************************************************************/
-int32 GPS_Serial_Close(gpsdevh *fd)
+int32 GPS_Serial_Close(gpsdevh* fd)
{
- posix_serial_data *psd = (posix_serial_data *)fd;
+ posix_serial_data* psd = (posix_serial_data*)fd;
if (tcsetattr(psd->fd, TCSAFLUSH, &psd->gps_ttysave)==-1) {
gps_errno = HARDWARE_ERROR;
** @return [int32] true if chars waiting
************************************************************************/
-int32 GPS_Serial_Chars_Ready(gpsdevh *dh)
+int32 GPS_Serial_Chars_Ready(gpsdevh* dh)
{
fd_set rec;
struct timeval t;
- posix_serial_data *psd = (posix_serial_data *)dh;
+ posix_serial_data* psd = (posix_serial_data*)dh;
int32 fd = psd->fd;
#if GARMULATOR
** @return [int32] true if serial chars waiting
************************************************************************/
-int32 GPS_Serial_Wait(gpsdevh *dh)
+int32 GPS_Serial_Wait(gpsdevh* dh)
{
fd_set rec;
struct timeval t;
- posix_serial_data *psd = (posix_serial_data *)dh;
+ posix_serial_data* psd = (posix_serial_data*)dh;
FD_ZERO(&rec);
FD_SET(psd->fd,&rec);
** @return [int32] success
************************************************************************/
-int32 GPS_Serial_On(const char *port, gpsdevh **dh)
+int32 GPS_Serial_On(const char* port, gpsdevh** dh)
{
- posix_serial_data *psd = (posix_serial_data*) xcalloc(sizeof(posix_serial_data), 1);
+ posix_serial_data* psd = (posix_serial_data*) xcalloc(sizeof(posix_serial_data), 1);
*dh = (gpsdevh*) psd;
- if (!GPS_Serial_Open((gpsdevh *) psd,port)) {
+ if (!GPS_Serial_Open((gpsdevh*) psd,port)) {
GPS_Error("Cannot open serial port '%s'", port);
gps_errno = SERIAL_ERROR;
return 0;
** @return [int32] success
************************************************************************/
-int32 GPS_Serial_Off(gpsdevh *dh)
+int32 GPS_Serial_Off(gpsdevh* dh)
{
if (!GPS_Serial_Close(dh)) {
#define usecDELAY 180000 /* Microseconds before GPS sends A001 */
- int32 GPS_Serial_Chars_Ready(gpsdevh * fd);
+ int32 GPS_Serial_Chars_Ready(gpsdevh* fd);
// int32 GPS_Serial_Close(int32 fd, const char *port);
// int32 GPS_Serial_Open(int32 *fd, const char *port);
// int32 GPS_Serial_Open_NMEA(int32 *fd, const char *port);
// int32 GPS_Serial_Restoretty(const char *port);
// int32 GPS_Serial_Savetty(const char *port);
- int32 GPS_Serial_On(const char *port, gpsdevh **fd);
- int32 GPS_Serial_Off(gpsdevh *fd);
- int32 GPS_Serial_Wait(gpsdevh *fd);
- int32 GPS_Serial_Flush(gpsdevh *fd);
+ int32 GPS_Serial_On(const char* port, gpsdevh** fd);
+ int32 GPS_Serial_Off(gpsdevh* fd);
+ int32 GPS_Serial_Wait(gpsdevh* fd);
+ int32 GPS_Serial_Flush(gpsdevh* fd);
// int32 GPS_Serial_On_NMEA(const char *port, gpsdevh **fd);
- int32 GPS_Serial_Read(gpsdevh *fd, void *ibuf, int size);
- int32 GPS_Serial_Write(gpsdevh *fd, const void *obuf, int size);
- int32 GPS_Serial_Write_Packet(gpsdevh *fd, GPS_PPacket packet);
- int32 GPS_Serial_Send_Ack(gpsdevh *fd, GPS_PPacket *tra, GPS_PPacket *rec);
- void GPS_Serial_Error(const char *hdr, ...);
+ int32 GPS_Serial_Read(gpsdevh* fd, void* ibuf, int size);
+ int32 GPS_Serial_Write(gpsdevh* fd, const void* obuf, int size);
+ int32 GPS_Serial_Write_Packet(gpsdevh* fd, GPS_PPacket packet);
+ int32 GPS_Serial_Send_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec);
+ void GPS_Serial_Error(const char* hdr, ...);
#endif
rs_frombulk
} receive_state;
-static gusb_llops_t *gusb_llops;
+static gusb_llops_t* gusb_llops;
/* Decide when to truncate packets for debug output */
#define DEBUG_THRESH ((global_opts.debug_level < 5) && (i > 10))
/* Called from OS layer to register its low-level entry points. */
void
-gusb_register_ll(gusb_llops_t *p)
+gusb_register_ll(gusb_llops_t* p)
{
gusb_llops = p;
}
int
-gusb_close(gpsdevh *dh)
+gusb_close(gpsdevh* dh)
{
garmin_usb_packet scratch;
int
-gusb_cmd_get(garmin_usb_packet *ibuf, size_t sz)
+gusb_cmd_get(garmin_usb_packet* ibuf, size_t sz)
{
int rv;
- unsigned char *buf = (unsigned char *) &ibuf->dbuf;
+ unsigned char* buf = (unsigned char*) &ibuf->dbuf;
int orig_receive_state;
unsigned short pkt_id;
top:
pkt_id = le_read16(&ibuf->gusb_pkt.pkt_id);
if (gps_show_bytes) {
int i;
- const char *m1, *m2;
+ const char* m1, *m2;
unsigned short pkttype = le_read16(&ibuf->gusb_pkt.databuf[0]);
GPS_Diag("RX (%s) [%d]:",
}
int
-gusb_cmd_send(const garmin_usb_packet *opkt, size_t sz)
+gusb_cmd_send(const garmin_usb_packet* opkt, size_t sz)
{
unsigned int rv, i;
- unsigned char *obuf = (unsigned char *) &opkt->dbuf;
- const char *m1, *m2;
+ unsigned char* obuf = (unsigned char*) &opkt->dbuf;
+ const char* m1, *m2;
rv = gusb_llops->llop_send(opkt, sz);
}
void
-gusb_id_unit(garmin_unit_info_t *gu)
+gusb_id_unit(garmin_unit_info_t* gu)
{
static const char oid[12] =
{20, 0, 0, 0, 0xfe, 0, 0, 0, 0, 0, 0, 0};
garmin_usb_packet iresp;
int i;
- gusb_cmd_send((garmin_usb_packet *)oid, sizeof(oid));
+ gusb_cmd_send((garmin_usb_packet*)oid, sizeof(oid));
for (i = 0; i < 25; i++) {
iresp.gusb_pkt.type = 0;
return;
}
if (le_read16(iresp.gusb_pkt.pkt_id) == 0xff) {
- gu->product_identifier = xstrdup((char *) iresp.gusb_pkt.databuf+4);
+ gu->product_identifier = xstrdup((char*) iresp.gusb_pkt.databuf+4);
gu->unit_id = le_read16(iresp.gusb_pkt.databuf+0);
gu->unit_version = le_read16(iresp.gusb_pkt.databuf+2);
}
le_write32(&iresp.gusb_pkt.datasz, 0);
le_write32(&iresp.gusb_pkt.databuf, 0);
- gusb_cmd_send((const garmin_usb_packet *) oinit, sizeof(oinit));
+ gusb_cmd_send((const garmin_usb_packet*) oinit, sizeof(oinit));
gusb_cmd_get(&iresp, sizeof(iresp));
if ((le_read16(iresp.gusb_pkt.pkt_id) == GUSB_SESSION_ACK) &&
* The 'low level ops' are registered by the OS layer (win32, libusb, etc.)
* to provide gruntwork features for the common USB layer.
*/
-typedef int (*gusb_llop_get)(garmin_usb_packet *ibuf, size_t sz);
-typedef int (*gusb_llop_send)(const garmin_usb_packet *opkt, size_t sz);
-typedef int (*gusb_llop_close)(gpsdevh *dh);
+typedef int (*gusb_llop_get)(garmin_usb_packet* ibuf, size_t sz);
+typedef int (*gusb_llop_send)(const garmin_usb_packet* opkt, size_t sz);
+typedef int (*gusb_llop_close)(gpsdevh* dh);
typedef struct gusb_llops {
gusb_llop_get llop_get_intr;
/* Provided by the common code. */
void gusb_syncup(void);
-void gusb_register_ll(struct gusb_llops *);
+void gusb_register_ll(struct gusb_llops*);
void gusb_list_units(void);
/* Provided by the OS layers */
*/
-int32 GPS_Packet_Read_usb(gpsdevh *fd, GPS_PPacket *packet, int eatbulk);
-void GPS_Make_Packet_usb(GPS_PPacket *packet, UC type, UC *data, int16 n);
-int32 GPS_Write_Packet_usb(gpsdevh *fd, GPS_PPacket packet);
+int32 GPS_Packet_Read_usb(gpsdevh* fd, GPS_PPacket* packet, int eatbulk);
+void GPS_Make_Packet_usb(GPS_PPacket* packet, UC type, UC* data, int16 n);
+int32 GPS_Write_Packet_usb(gpsdevh* fd, GPS_PPacket packet);
* Negative on error.
* 1 if read success - even if empty packet.
*/
-int32 GPS_Packet_Read_usb(gpsdevh *dh, GPS_PPacket *packet, int eat_bulk)
+int32 GPS_Packet_Read_usb(gpsdevh* dh, GPS_PPacket* packet, int eat_bulk)
{
int32 n;
int32 payload_size;
#include "gpsusbint.h"
int32
-GPS_Write_Packet_usb(gpsdevh *dh, GPS_PPacket packet)
+GPS_Write_Packet_usb(gpsdevh* dh, GPS_PPacket packet)
{
garmin_usb_packet gp;
memset(&gp, 0, sizeof(gp));
const char no_usb[] = "USB support is not available in this build.\n";
int
-gusb_init(const char *portname)
+gusb_init(const char* portname)
{
fatal(no_usb);
return 0;
int booger;
} winusb_unit_data;
-static HANDLE *usb_handle = INVALID_HANDLE_VALUE;
+static HANDLE* usb_handle = INVALID_HANDLE_VALUE;
static int usb_tx_packet_size ;
-static const gdx_info *gdx;
+static const gdx_info* gdx;
static int
-gusb_win_close(gpsdevh *handle)
+gusb_win_close(gpsdevh* handle)
{
if (usb_handle != INVALID_HANDLE_VALUE) {
CloseHandle(usb_handle);
}
static int
-gusb_win_get(garmin_usb_packet *ibuf, size_t sz)
+gusb_win_get(garmin_usb_packet* ibuf, size_t sz)
{
DWORD rxed = GARMIN_USB_INTERRUPT_DATA_SIZE;
- unsigned char *buf = (unsigned char *) &ibuf->dbuf;
+ unsigned char* buf = (unsigned char*) &ibuf->dbuf;
int tsz=0;
while (sz) {
}
static int
-gusb_win_get_bulk(garmin_usb_packet *ibuf, size_t sz)
+gusb_win_get_bulk(garmin_usb_packet* ibuf, size_t sz)
{
int n;
DWORD rsz;
- unsigned char *buf = (unsigned char *) &ibuf->dbuf;
+ unsigned char* buf = (unsigned char*) &ibuf->dbuf;
n = ReadFile(usb_handle, buf, sz, &rsz, NULL);
}
static int
-gusb_win_send(const garmin_usb_packet *opkt, size_t sz)
+gusb_win_send(const garmin_usb_packet* opkt, size_t sz)
{
DWORD rsz;
- unsigned char *obuf = (unsigned char *) &opkt->dbuf;
+ unsigned char* obuf = (unsigned char*) &opkt->dbuf;
/* The spec warns us about making writes an exact multiple
* of the packet size, but isn't clear whether we can issue
};
static
-HANDLE * garmin_usb_start(HDEVINFO* hdevinfo, SP_DEVICE_INTERFACE_DATA *infodata)
+HANDLE* garmin_usb_start(HDEVINFO* hdevinfo, SP_DEVICE_INTERFACE_DATA* infodata)
{
DWORD size;
PSP_INTERFACE_DEVICE_DETAIL_DATA pdd = NULL;
}
-static char ** get_garmin_mountpoints(void)
+static char** get_garmin_mountpoints(void)
{
#define BUFSIZE 512
TCHAR szTemp[MAX_PATH];
- char *p = szTemp;
- char **dlist = xmalloc(sizeof(*dlist));
+ char* p = szTemp;
+ char** dlist = xmalloc(sizeof(*dlist));
int i = 0;
dlist[0] = NULL;
* device, and light it up.
*/
int
-gusb_init(const char *pname, gpsdevh **dh)
+gusb_init(const char* pname, gpsdevh** dh)
{
int req_unit_number = 0;
int un = 0;
HDEVINFO hdevinfo;
SP_DEVICE_INTERFACE_DATA devinterface;
- winusb_unit_data *wud = xcalloc(sizeof(winusb_unit_data), 1);
+ winusb_unit_data* wud = xcalloc(sizeof(winusb_unit_data), 1);
*dh = (gpsdevh*) wud;
gusb_register_ll(&win_llops);
}
}
- hdevinfo = SetupDiGetClassDevs((GUID *) &GARMIN_GUID, NULL, NULL,
+ hdevinfo = SetupDiGetClassDevs((GUID*) &GARMIN_GUID, NULL, NULL,
DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
if (hdevinfo == INVALID_HANDLE_VALUE) {
if (req_unit_number >= 0) {
if (!SetupDiEnumDeviceInterfaces(hdevinfo, NULL,
- (GUID *) &GARMIN_GUID,
+ (GUID*) &GARMIN_GUID,
req_unit_number, &devinterface)) {
// If there were zero matches, we may be trying to talk to a "GPX Mode" device.
- char **dlist = get_garmin_mountpoints();
+ char** dlist = get_garmin_mountpoints();
gdx = gdx_find_file(dlist);
if (gdx) {
return 1;
*/
for (match = 0;; match++) {
if (!SetupDiEnumDeviceInterfaces(hdevinfo, NULL,
- (GUID *) &GARMIN_GUID, match, &devinterface)) {
+ (GUID*) &GARMIN_GUID, match, &devinterface)) {
if (GetLastError() == ERROR_NO_MORE_ITEMS) {
break;
** @return [US] value
************************************************************************/
-US GPS_Util_Get_Short(const UC *s)
+US GPS_Util_Get_Short(const UC* s)
{
static US ret;
- UC *p;
+ UC* p;
- p = (UC *)&ret;
+ p = (UC*)&ret;
if (!GPS_Little) {
*p++ = *(s+1);
** @return [void]
************************************************************************/
-void GPS_Util_Put_Short(UC *s, const US v)
+void GPS_Util_Put_Short(UC* s, const US v)
{
- UC *p;
+ UC* p;
- p = (UC *)&v;
+ p = (UC*)&v;
if (!GPS_Little) {
*s++ = *(p+1);
** @return [double] value
************************************************************************/
-double GPS_Util_Get_Double(const UC *s)
+double GPS_Util_Get_Double(const UC* s)
{
double ret;
- UC *p;
+ UC* p;
int32 i;
- p = (UC *)&ret;
+ p = (UC*)&ret;
if (!GPS_Little)
** @return [void]
************************************************************************/
-void GPS_Util_Put_Double(UC *s, const double v)
+void GPS_Util_Put_Double(UC* s, const double v)
{
- UC *p;
+ UC* p;
int32 i;
- p = (UC *)&v;
+ p = (UC*)&v;
if (!GPS_Little)
for (i=sizeof(double)-1; i>-1; --i) {
** @return [int32] value
************************************************************************/
-int32 GPS_Util_Get_Int(const UC *s)
+int32 GPS_Util_Get_Int(const UC* s)
{
int32 ret;
- UC *p;
+ UC* p;
int32 i;
- p = (UC *)&ret;
+ p = (UC*)&ret;
if (!GPS_Little)
** @return [void]
************************************************************************/
-void GPS_Util_Put_Int(UC *s, const int32 v)
+void GPS_Util_Put_Int(UC* s, const int32 v)
{
- UC *p;
+ UC* p;
int32 i;
- p = (UC *)&v;
+ p = (UC*)&v;
if (!GPS_Little)
for (i=sizeof(int32)-1; i>-1; --i) {
** @return [uint32] value
************************************************************************/
-uint32 GPS_Util_Get_Uint(const UC *s)
+uint32 GPS_Util_Get_Uint(const UC* s)
{
uint32 ret;
- UC *p;
+ UC* p;
int32 i;
- p = (UC *)&ret;
+ p = (UC*)&ret;
if (!GPS_Little)
** @return [void]
************************************************************************/
-void GPS_Util_Put_Uint(UC *s, const uint32 v)
+void GPS_Util_Put_Uint(UC* s, const uint32 v)
{
- UC *p;
+ UC* p;
int32 i;
- p = (UC *)&v;
+ p = (UC*)&v;
if (!GPS_Little)
for (i=sizeof(uint32)-1; i>-1; --i) {
** @return [float] value
************************************************************************/
-float GPS_Util_Get_Float(const UC *s)
+float GPS_Util_Get_Float(const UC* s)
{
float ret;
- UC *p;
+ UC* p;
int32 i;
- p = (UC *)&ret;
+ p = (UC*)&ret;
if (!GPS_Little)
** @return [void]
************************************************************************/
-void GPS_Util_Put_Float(UC *s, const float v)
+void GPS_Util_Put_Float(UC* s, const float v)
{
- UC *p;
+ UC* p;
int32 i;
- p = (UC *)&v;
+ p = (UC*)&v;
if (!GPS_Little)
for (i=sizeof(float)-1; i>-1; --i) {
** @@
****************************************************************************/
-void GPS_Warning(char *s)
+void GPS_Warning(char* s)
{
if (!gps_warning) {
return;
** @@
****************************************************************************/
-void GPS_Fatal(char *s)
+void GPS_Fatal(char* s)
{
fprintf(stderr,"[FATAL] %s\n",s);
** @@
****************************************************************************/
-void GPS_Error(char *fmt, ...)
+void GPS_Error(char* fmt, ...)
{
va_list argp;
va_start(argp, fmt);
** @@
****************************************************************************/
-void GPS_User(const char *fmt, ...)
+void GPS_User(const char* fmt, ...)
{
va_list argp;
va_start(argp, fmt);
return;
}
-void GPS_Diag(const char *fmt, ...)
+void GPS_Diag(const char* fmt, ...)
{
va_list argp;
va_start(argp, fmt);
int32 GPS_Util_Little(void);
- US GPS_Util_Get_Short(const UC *s);
- void GPS_Util_Put_Short(UC *s, const US v);
- int32 GPS_Util_Get_Int(const UC *s);
- void GPS_Util_Put_Int(UC *s, const int32 v);
- double GPS_Util_Get_Double(const UC *s);
- void GPS_Util_Put_Double(UC *s, const double v);
- float GPS_Util_Get_Float(const UC *s);
- void GPS_Util_Put_Float(UC *s, const float v);
+ US GPS_Util_Get_Short(const UC* s);
+ void GPS_Util_Put_Short(UC* s, const US v);
+ int32 GPS_Util_Get_Int(const UC* s);
+ void GPS_Util_Put_Int(UC* s, const int32 v);
+ double GPS_Util_Get_Double(const UC* s);
+ void GPS_Util_Put_Double(UC* s, const double v);
+ float GPS_Util_Get_Float(const UC* s);
+ void GPS_Util_Put_Float(UC* s, const float v);
void GPS_Util_Canon(int32 state);
int32 GPS_Util_Block(int32 fd, int32 state);
- void GPS_Util_Put_Uint(UC *s, const uint32 v);
- uint32 GPS_Util_Get_Uint(const UC *s);
+ void GPS_Util_Put_Uint(UC* s, const uint32 v);
+ uint32 GPS_Util_Get_Uint(const UC* s);
- void GPS_Warning(char *s);
- void GPS_Error(char *fmt, ...);
- void GPS_Serial_Error(const char *hdr, ...);
- void GPS_Fatal(char *s);
+ void GPS_Warning(char* s);
+ void GPS_Error(char* fmt, ...);
+ void GPS_Serial_Error(const char* hdr, ...);
+ void GPS_Fatal(char* s);
void GPS_Enable_Error(void);
void GPS_Enable_Warning(void);
void GPS_Disable_Error(void);
void GPS_Disable_Warning(void);
- void GPS_User(const char *fmt, ...);
+ void GPS_User(const char* fmt, ...);
void GPS_Disable_User(void);
void GPS_Enable_User(void);
void GPS_Diagnose(int32 c);
- void GPS_Diag(const char *fmt, ...);
+ void GPS_Diag(const char* fmt, ...);
void GPS_Enable_Diagnose(void);
void GPS_Disable_Diagnose(void);
main()
{
int n;
- GPS_PWay *way;
- GPS_PWay *array;
+ GPS_PWay* way;
+ GPS_PWay* array;
if (GPS_Init("/dev/ttyS0") < 0) {
fprintf(stderr, "Can't init\n");
GPS_Fmt_Print_Waypoint(way, n, stdout);
- array = (GPS_PWay *) calloc(1, sizeof(GPS_PWay));
+ array = (GPS_PWay*) calloc(1, sizeof(GPS_PWay));
array[0] = GPS_Way_New();
strcpy(array[0]->ident,"lower @#$%^&* rocks");
strcpy(array[0]->cmnt,"COMMENTCOMMENTCOMMENTCOMMENTCOMMENT");
#include "jeeps/gpsmath.h"
#include "garmin_tables.h"
-static route_head *trk;
+static route_head* trk;
static arglist_t jogmap_args[] = {
ARG_TERMINATOR
#if ! HAVE_LIBEXPAT
void
-jogmap_rd_init(const char *fname)
+jogmap_rd_init(const char* fname)
{
fatal(MYNAME ": This build excluded \"" MYNAME "\" support because expat was not installed.\n");
}
static void
-jogmap_markers(const char *args, const char **attrv)
+jogmap_markers(const char* args, const char** attrv)
{
trk = route_head_alloc();
track_add_head(trk);
}
static void
-jogmap_marker(const char *args, const char **attrv)
+jogmap_marker(const char* args, const char** attrv)
{
- const char **avp = &attrv[0];
- waypoint *wpt = waypt_new();
+ const char** avp = &attrv[0];
+ waypoint* wpt = waypt_new();
while (*avp) {
if (strcmp(avp[0], "lat") == 0) {
xg_tag_mapping jogmap_map[] = {
{ jogmap_markers, cb_start, "/markers" },
{ jogmap_marker, cb_start, "/markers/marker" },
- { NULL, 0, NULL }
+ { NULL, (xg_cb_type)0, NULL }
};
static void
-jogmap_rd_init(const char *fname)
+jogmap_rd_init(const char* fname)
{
trk = NULL;
xml_init(fname, jogmap_map, NULL);
ARG_TERMINATOR
};
-static gbfile *fin, *fout;
-static avltree_t *trkpts;
+static gbfile* fin, *fout;
+static avltree_t* trkpts;
static time_t
-jtr_parse_time(const char *str, struct tm *tm, int *micro)
+jtr_parse_time(const char* str, struct tm* tm, int* micro)
{
long int hms;
- char *dot;
+ char* dot;
hms = strtol(str, &dot, 10);
if (hms > 0) {
}
static time_t
-jtr_parse_date(const char *str, struct tm *tm)
+jtr_parse_date(const char* str, struct tm* tm)
{
int dmy = atoi(str);
*******************************************************************************/
static void
-jtr_rd_init(const char *fname)
+jtr_rd_init(const char* fname)
{
fin = gbfopen(fname, "r", MYNAME);
trkpts = avltree_init(0, MYNAME);
static void
jtr_read(void)
{
- char *str;
+ char* str;
int line = 0;
- route_head *trk = NULL;
+ route_head* trk = NULL;
while ((str = gbfgetstr(fin))) {
- waypoint *wpt;
+ waypoint* wpt;
struct tm tm;
- char *tmp;
+ char* tmp;
int column = -1;
char valid = 'V';
double lat, lon;
}
static void
-jtr_wr_init(const char *fname)
+jtr_wr_init(const char* fname)
{
fout = gbfopen(fname, "wb", MYNAME);
}
}
static void
-jtr_trkpt_disp_cb(const waypoint *wpt)
+jtr_trkpt_disp_cb(const waypoint* wpt)
{
- char *str, *tmp;
+ char* str, *tmp;
char stime[10], sdate[7], scourse[6], sspeed[8];
struct tm tm;
ff_type_file,
{
ff_cap_none, /* waypoints */
- ff_cap_read | ff_cap_write, /* tracks */
+ (ff_cap)(ff_cap_read | ff_cap_write), /* tracks */
ff_cap_none /* routes */
},
jtr_rd_init,
#endif
// options
-static char *opt_deficon = NULL;
-static char *opt_export_lines = NULL;
-static char *opt_export_points = NULL;
-static char *opt_export_track = NULL;
-static char *opt_line_width = NULL;
-static char *opt_line_color = NULL;
-static char *opt_floating = NULL;
-static char *opt_extrude = NULL;
-static char *opt_trackdata = NULL;
-static char *opt_trackdirection = NULL;
-static char *opt_units = NULL;
-static char *opt_labels = NULL;
-static char *opt_max_position_points = NULL;
+static char* opt_deficon = NULL;
+static char* opt_export_lines = NULL;
+static char* opt_export_points = NULL;
+static char* opt_export_track = NULL;
+static char* opt_line_width = NULL;
+static char* opt_line_color = NULL;
+static char* opt_floating = NULL;
+static char* opt_extrude = NULL;
+static char* opt_trackdata = NULL;
+static char* opt_trackdirection = NULL;
+static char* opt_units = NULL;
+static char* opt_labels = NULL;
+static char* opt_max_position_points = NULL;
static int export_lines;
static int export_points;
static int indent_level;
-static waypoint *wpt_tmp;
+static waypoint* wpt_tmp;
static int wpt_tmp_queued;
-static const char *posnfilename;
-static char *posnfilenametmp;
+static const char* posnfilename;
+static char* posnfilenametmp;
-static gbfile *ofd;
+static gbfile* ofd;
#define COORD_FORMAT "%.6f"
#define ALT_FORMAT "%.2f" // Beyond a centimeter is fantasy.
static
struct {
int freshness;
- const char *icon;
+ const char* icon;
} kml_tracking_icons[] = {
{ 60, ICON_BASE "youarehere-60.png" }, // Red
{ 30, ICON_BASE "youarehere-30.png" }, // Yellow
#if ! HAVE_LIBEXPAT
static void
-kml_rd_init(const char *fname)
+kml_rd_init(const char* fname)
{
fatal(MYNAME ": This build excluded KML support because expat was not installed.\n");
}
};
static
-const char * kml_tags_to_ignore[] = {
+const char* kml_tags_to_ignore[] = {
"kml",
"Document",
"Folder",
NULL,
};
-void wpt_s(const char *args, const char **unused)
+void wpt_s(const char* args, const char** unused)
{
wpt_tmp = waypt_new();
wpt_tmp_queued = 0;
}
-void wpt_e(const char *args, const char **unused)
+void wpt_e(const char* args, const char** unused)
{
if (wpt_tmp_queued) {
waypt_add(wpt_tmp);
wpt_tmp_queued = 0;
}
-void wpt_name(const char *args, const char **unused)
+void wpt_name(const char* args, const char** unused)
{
if (args) {
wpt_tmp->shortname = xstrdup(args);
}
}
-void wpt_desc(const char *args, const char **unused)
+void wpt_desc(const char* args, const char** unused)
{
if (args) {
- char *tmp, *c;
+ char* tmp, *c;
- tmp = xstrdup((char *)args);
+ tmp = xstrdup((char*)args);
c = lrtrim(tmp);
if (*c) {
wpt_tmp->description = xstrappend(wpt_tmp->description, c);
}
}
-void wpt_time(const char *args, const char **unused)
+void wpt_time(const char* args, const char** unused)
{
wpt_tmp->creation_time = xml_parse_time(args, &wpt_tmp->microseconds);
}
-void wpt_coord(const char *args, const char **attrv)
+void wpt_coord(const char* args, const char** attrv)
{
int n = 0;
double lat, lon, alt;
wpt_tmp_queued = 1;
}
-void wpt_icon(const char *args, const char **unused)
+void wpt_icon(const char* args, const char** unused)
{
if (wpt_tmp) {
wpt_tmp->icon_descr = xstrdup(args);
}
}
-void trk_coord(const char *args, const char **attrv)
+void trk_coord(const char* args, const char** attrv)
{
int consumed = 0;
double lat, lon, alt;
- waypoint *trkpt;
+ waypoint* trkpt;
int n = 0;
- route_head *trk_head = route_head_alloc();
+ route_head* trk_head = route_head_alloc();
if (wpt_tmp->shortname) {
trk_head->rte_name = xstrdup(wpt_tmp->shortname);
}
static
void
-kml_rd_init(const char *fname)
+kml_rd_init(const char* fname)
{
xml_init(fname, kml_map, NULL);
xml_ignore_tags(kml_tags_to_ignore);
}
static void
-kml_wr_init(const char *fname)
+kml_wr_init(const char* fname)
{
char u = 's';
waypt_init_bounds(&kml_bounds);
* updated.
*/
static void
-kml_wr_position_init(const char *fname)
+kml_wr_position_init(const char* fname)
{
posnfilename = fname;
posnfilenametmp = xstrappend(xstrdup(fname), "-");
* If negative, descrease the indent level.
*/
static void
-kml_write_xml(int indent, const char *fmt, ...)
+kml_write_xml(int indent, const char* fmt, ...)
{
va_list args;
int i;
* Never changes indention leve, but does honour it.
*/
static void
-kml_write_xmle(const char *tag, const char *fmt, ...)
+kml_write_xmle(const char* tag, const char* fmt, ...)
{
va_list args;
int i;
va_start(args, fmt);
if (fmt && *fmt) {
- char *tmp_ent = xml_entitize(fmt);
+ char* tmp_ent = xml_entitize(fmt);
int needs_escaping = 0;
for (i = 0; i < indent_level; i++) {
gbfputs(" ", ofd);
}
void
-kml_output_linestyle(char *color, int width)
+kml_output_linestyle(char* color, int width)
{
// Style settings for line strings
kml_write_xml(1, "<LineStyle>\n");
#define hovertag(h) h ? 'h' : 'n'
-static void kml_write_bitmap_style_(const char *style, const char * bitmap,
+static void kml_write_bitmap_style_(const char* style, const char* bitmap,
int highlighted, int force_heading)
{
int is_track = !strncmp(style, "track", 5);
* and non-highlighted version of the style to allow the icons
* to magnify slightly on a rollover.
*/
-static void kml_write_bitmap_style(kml_point_type pt_type, const char *bitmap,
- const char *customstyle)
+static void kml_write_bitmap_style(kml_point_type pt_type, const char* bitmap,
+ const char* customstyle)
{
int force_heading = 0;
- const char *style;
+ const char* style;
switch (pt_type) {
case kmlpt_track:
style = "track";
kml_write_xml(-1, "</StyleMap>\n");
}
-static void kml_output_timestamp(const waypoint *waypointp)
+static void kml_output_timestamp(const waypoint* waypointp)
{
char time_string[64];
if (waypointp->creation_time) {
* Output the track summary.
*/
static
-void kml_output_trkdescription(const route_head *header, computed_trkdata *td)
+void kml_output_trkdescription(const route_head* header, computed_trkdata* td)
{
- char *max_alt_units;
+ char* max_alt_units;
double max_alt;
- char *min_alt_units;
+ char* min_alt_units;
double min_alt;
- char *distance_units;
+ char* distance_units;
double distance;
if (!td || !trackdata) {
TD2("<b>Max Alt</b> %.3f %s", max_alt, max_alt_units);
}
if (td->min_spd) {
- char *spd_units;
+ char* spd_units;
double spd = fmt_speed(td->min_spd, &spd_units);
TD2("<b>Min Speed</b> %.1f %s", spd, spd_units);
}
if (td->max_spd) {
- char *spd_units;
+ char* spd_units;
double spd = fmt_speed(td->max_spd, &spd_units);
TD2("<b>Max Speed</b> %.1f %s", spd, spd_units);
}
if (td->max_spd && td->start && td->end) {
- char *spd_units;
+ char* spd_units;
time_t elapsed = td->end - td->start;
double spd = fmt_speed(td->distance_meters / elapsed, &spd_units);
if (spd > 1.0) {
static
-void kml_output_header(const route_head *header, computed_trkdata*td)
+void kml_output_header(const route_head* header, computed_trkdata* td)
{
if (!realtime_positioning) {
kml_write_xml(1, "<Folder>\n");
}
static
-int kml_altitude_known(const waypoint *waypoint)
+int kml_altitude_known(const waypoint* waypoint)
{
if (waypoint->altitude == unknown_alt) {
return 0;
}
static
-void kml_write_coordinates(const waypoint *waypointp)
+void kml_write_coordinates(const waypoint* waypointp)
{
if (kml_altitude_known(waypointp)) {
kml_write_xml(0, "<coordinates>"
/* Rather than a default "top down" view, view from the side to highlight
* topo features.
*/
-static void kml_output_lookat(const waypoint *waypointp)
+static void kml_output_lookat(const waypoint* waypointp)
{
kml_write_xml(1, "<LookAt>\n");
kml_write_xml(0, "<longitude>%f</longitude>\n", waypointp->longitude);
}
/* Output something interesing when we can for route and trackpoints */
-static void kml_output_description(const waypoint *pt)
+static void kml_output_description(const waypoint* pt)
{
- char *alt_units;
+ char* alt_units;
double alt;
if (!trackdata) {
TD("Temperature: %.1f", pt->temperature);
}
if WAYPT_HAS(pt, depth) {
- char *depth_units;
+ char* depth_units;
double depth = fmt_distance(pt->depth, &depth_units);
TD2("Depth: %.1f %s", depth, depth_units);
}
if WAYPT_HAS(pt, speed) {
- char *spd_units;
+ char* spd_units;
double spd = fmt_speed(pt->speed, &spd_units);
TD2("Speed: %.1f %s", spd, spd_units);
}
kml_write_xml(-1, "]]></description>\n");
}
-static void kml_recompute_time_bounds(const waypoint *waypointp)
+static void kml_recompute_time_bounds(const waypoint* waypointp)
{
if (waypointp->creation_time && (waypointp->creation_time < kml_time_min)) {
kml_time_min = waypointp->creation_time;
}
}
-static void kml_add_to_bounds(const waypoint *waypointp)
+static void kml_add_to_bounds(const waypoint* waypointp)
{
waypt_add_to_bounds(&kml_bounds, waypointp);
kml_recompute_time_bounds(waypointp);
}
-static void kml_output_point(const waypoint *waypointp, kml_point_type pt_type)
+static void kml_output_point(const waypoint* waypointp, kml_point_type pt_type)
{
- const char *style;
+ const char* style;
switch (pt_type) {
case kmlpt_track:
}
}
-static void kml_output_tailer(const route_head *header)
+static void kml_output_tailer(const route_head* header)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
if (export_points && header->rte_waypt_ct > 0) {
kml_write_xml(-1, "</Folder>\n");
if (export_lines && header->rte_waypt_ct > 0) {
int needs_multigeometry = 0;
QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) {
- waypoint *tpt = (waypoint *) elem;
+ waypoint* tpt = (waypoint*) elem;
int first_in_trk = tpt->Q.prev == &header->waypoint_list;
if (!first_in_trk && tpt->wpt_flags.new_trkseg) {
needs_multigeometry = 1;
}
QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) {
- waypoint *tpt = (waypoint *) elem;
+ waypoint* tpt = (waypoint*) elem;
int first_in_trk = tpt->Q.prev == &header->waypoint_list;
if (tpt->wpt_flags.new_trkseg) {
if (!first_in_trk) {
}
static
-char *
-kml_lookup_gc_icon(const waypoint *waypointp)
+char*
+kml_lookup_gc_icon(const waypoint* waypointp)
{
- const char *icon;
- char *rb;
+ const char* icon;
+ char* rb;
/* This could be done so much better in C99 with designated
* initializers...
}
static const
-char *
-kml_lookup_gc_container(const waypoint *waypointp)
+char*
+kml_lookup_gc_container(const waypoint* waypointp)
{
- const char *cont;
+ const char* cont;
switch (waypointp->gc_data->container) {
case gc_micro:
// Not thread safe. Return strings are small and it's silly to xasprintf/free
// them so we use a static buffer.
-char * kml_gc_mkstar(int rating)
+char* kml_gc_mkstar(int rating)
{
static char tmp[40];
if (0 == rating % 10) {
return tmp;
}
-static void kml_geocache_pr(const waypoint *waypointp)
+static void kml_geocache_pr(const waypoint* waypointp)
{
- char *p, *is;
+ char* p, *is;
kml_write_xml(1, "<Placemark>\n");
* WAYPOINTS
*/
-static void kml_waypt_pr(const waypoint *waypointp)
+static void kml_waypt_pr(const waypoint* waypointp)
{
- const char *icon;
+ const char* icon;
#if 0 // Experimental
if (realtime_positioning) {
// Description
if (waypointp->url && waypointp->url[0]) {
- char * odesc = xml_entitize(waypointp->url);
+ char* odesc = xml_entitize(waypointp->url);
kml_write_xml(0, "<Snippet/>\n");
kml_write_xml(0, "<description>\n");
if (waypointp->url_link_text && waypointp->url_link_text[0]) {
- char *olink = xml_entitize(waypointp->url_link_text);
+ char* olink = xml_entitize(waypointp->url_link_text);
kml_write_xml(0, "<![CDATA[<a href=\"%s\">%s</a>]]>", odesc, olink);
xfree(olink);
} else {
* TRACKPOINTS
*/
-static void kml_track_hdr(const route_head *header)
+static void kml_track_hdr(const route_head* header)
{
- computed_trkdata *td;
+ computed_trkdata* td;
track_recompute(header, &td);
if (header->rte_waypt_ct > 0 && (export_lines || export_points)) {
kml_output_header(header, td);
xfree(td);
}
-static void kml_track_disp(const waypoint *waypointp)
+static void kml_track_disp(const waypoint* waypointp)
{
kml_output_point(waypointp, kmlpt_track);
}
-static void kml_track_tlr(const route_head *header)
+static void kml_track_tlr(const route_head* header)
{
if (header->rte_waypt_ct > 0 && (export_lines || export_points)) {
kml_output_tailer(header);
sl_float,
sl_double,
} sl_element;
-static void kml_mt_simple_array(const route_head *header,
- const char *name, const char *fmt_string,
+static void kml_mt_simple_array(const route_head* header,
+ const char* name, const char* fmt_string,
int offset, sl_element type)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
kml_write_xml(1, "<gx:SimpleArrayData name=\"%s\">\n", name);
QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) {
- char *datap = (char*) elem + offset;
+ char* datap = (char*) elem + offset;
switch (type) {
case sl_char: {
- char data = *(char *) datap;
+ char data = *(char*) datap;
kml_write_xmle("gx:value", fmt_string, data);
}
break;
case sl_uchar: {
- unsigned char data = *(unsigned char *) datap;
+ unsigned char data = *(unsigned char*) datap;
kml_write_xmle("gx:value", fmt_string, data);
}
break;
case sl_int: {
- int data = *(int *) datap;
+ int data = *(int*) datap;
kml_write_xmle("gx:value", fmt_string, data);
}
break;
case sl_float: {
- float data = *(float *) datap;
+ float data = *(float*) datap;
kml_write_xmle("gx:value", fmt_string, data);
}
break;
case sl_double: {
- double data = *(double *) datap;
+ double data = *(double*) datap;
kml_write_xmle("gx:value", fmt_string, data);
}
break;
}
// True if at least two points in the track have timestamps.
-static int track_has_time(const route_head *header)
+static int track_has_time(const route_head* header)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
int points_with_time = 0;
QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) {
- waypoint *tpt = (waypoint *)elem;
+ waypoint* tpt = (waypoint*)elem;
if (tpt->creation_time) {
points_with_time++;
}
// Simulate a track_disp_all callback sequence for a single track.
-static void write_as_linestring(const route_head *header)
+static void write_as_linestring(const route_head* header)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
kml_track_hdr(header);
QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) {
- waypoint *tpt = (waypoint *)elem;
+ waypoint* tpt = (waypoint*)elem;
kml_track_disp(tpt);
}
kml_track_tlr(header);
}
-static void kml_mt_hdr(const route_head *header)
+static void kml_mt_hdr(const route_head* header)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
int has_cadence = 0;
int has_depth = 0;
int has_heartrate = 0;
QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) {
char time_string[64];
- waypoint *tpt = (waypoint *)elem;
+ waypoint* tpt = (waypoint*)elem;
if (tpt->creation_time) {
xml_fill_in_time(time_string, tpt->creation_time, tpt->microseconds,
// TODO: How to handle clamped, floating, extruded, etc.?
QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) {
- waypoint *tpt = (waypoint *)elem;
+ waypoint* tpt = (waypoint*)elem;
if (kml_altitude_known(tpt)) {
kml_write_xmle("gx:coord", COORD_FORMAT " " COORD_FORMAT " " ALT_FORMAT,
}
}
-static void kml_mt_tlr(const route_head *header)
+static void kml_mt_tlr(const route_head* header)
{
if (track_has_time(header)) {
kml_write_xml(-1, "</gx:Track>\n");
* ROUTES
*/
-static void kml_route_hdr(const route_head *header)
+static void kml_route_hdr(const route_head* header)
{
kml_output_header(header, NULL);
}
-static void kml_route_disp(const waypoint *waypointp)
+static void kml_route_disp(const waypoint* waypointp)
{
kml_output_point(waypointp, kmlpt_route);
}
-static void kml_route_tlr(const route_head *header)
+static void kml_route_tlr(const route_head* header)
{
kml_output_tailer(header);
}
}
static
-void kml_mt_array_schema(const char *field_name, const char *display_name,
- const char *type)
+void kml_mt_array_schema(const char* field_name, const char* display_name,
+ const char* type)
{
kml_write_xml(1, "<gx:SimpleArrayField name=\"%s\" type=\"%s\">\n",
field_name, type);
* This depends on the table being sorted correctly.
*/
static const
-char *
+char*
kml_get_posn_icon(int freshness)
{
int i;
}
-static route_head *posn_trk_head = NULL;
+static route_head* posn_trk_head = NULL;
static void
-kml_wr_position(waypoint *wpt)
+kml_wr_position(waypoint* wpt)
{
static time_t last_valid_fix;
track points if we've not moved a minimum distance from the
beginnning of our accumulated track. */
{
- waypoint *newest_posn= (waypoint *) QUEUE_LAST(&posn_trk_head->waypoint_list);
+ waypoint* newest_posn= (waypoint*) QUEUE_LAST(&posn_trk_head->waypoint_list);
if (radtometers(gcdist(RAD(wpt->latitude), RAD(wpt->longitude),
RAD(newest_posn->latitude), RAD(newest_posn->longitude))) > 50) {
*/
while (max_position_points &&
(posn_trk_head->rte_waypt_ct >= max_position_points)) {
- waypoint *tonuke = (waypoint *) QUEUE_FIRST(&posn_trk_head->waypoint_list);
+ waypoint* tonuke = (waypoint*) QUEUE_FIRST(&posn_trk_head->waypoint_list);
track_del_wpt(posn_trk_head, tonuke);
}
#include "defs.h"
#include "xmlgeneric.h"
-static gbfile *ofd;
-static waypoint *wpt_tmp;
-char *urllink, *urllinkt;
-static char *binary = NULL;
+static gbfile* ofd;
+static waypoint* wpt_tmp;
+char* urllink, *urllinkt;
+static char* binary = NULL;
#define MYNAME "lmx"
static void
-lmx_wr_init(const char *fname)
+lmx_wr_init(const char* fname)
{
ofd = gbfopen(fname, "w", MYNAME);
}
gbfclose(ofd);
}
-static char *
+static char*
lmx_stag(int tag)
{
switch (tag) {
}
static void
-lmx_write_xml(int tag, const char *data, int indent)
+lmx_write_xml(int tag, const char* data, int indent)
{
lmx_start_tag(tag, indent);
gbfputc(0x03, ofd); // inline string follows
gbfputcstr(data, ofd);
} else {
- char *tmp_ent = xml_entitize(data);
+ char* tmp_ent = xml_entitize(data);
gbfputs(tmp_ent, ofd);
xfree(tmp_ent);
}
}
static void
-lmx_print(const waypoint *wpt)
+lmx_print(const waypoint* wpt)
{
- const char *oname;
- char *odesc;
+ const char* oname;
+ char* odesc;
char tbuf[100];
/*
{ lmx_lm_link, cb_cdata, LM "/lm:mediaLink/lm:url" },
{ lmx_lm_linkt, cb_cdata, LM "/lm:mediaLink/lm:name" },
{ lmx_lm_mlink_e, cb_end, LM "/lm:mediaLink" },
- { NULL, 0, NULL}
+ { NULL, (xg_cb_type)0, NULL}
};
static void
-lmx_rd_init(const char *fname)
+lmx_rd_init(const char* fname)
{
xml_init(fname, gl_map, NULL);
}
static void
-lmx_lm_start(const char *args, const char **unused)
+lmx_lm_start(const char* args, const char** unused)
{
wpt_tmp = waypt_new();
}
static void
-lmx_lm_end(const char *args, const char **unused)
+lmx_lm_end(const char* args, const char** unused)
{
waypt_add(wpt_tmp);
}
static void
-lmx_lm_lat(const char *args, const char **unused)
+lmx_lm_lat(const char* args, const char** unused)
{
wpt_tmp->latitude = atof(args);
}
static void
-lmx_lm_lon(const char *args, const char **unused)
+lmx_lm_lon(const char* args, const char** unused)
{
wpt_tmp->longitude = atof(args);
}
static void
-lmx_lm_alt(const char *args, const char **unused)
+lmx_lm_alt(const char* args, const char** unused)
{
wpt_tmp->altitude = atof(args);
}
static void
-lmx_lm_name(const char *args, const char **unused)
+lmx_lm_name(const char* args, const char** unused)
{
wpt_tmp->shortname = xstrdup(args);
}
static void
-lmx_lm_desc(const char *args, const char **unused)
+lmx_lm_desc(const char* args, const char** unused)
{
wpt_tmp->description = xstrdup(args);
}
static void
-lmx_lm_mlink_s(const char *args, const char **unused)
+lmx_lm_mlink_s(const char* args, const char** unused)
{
urllink = urllinkt = NULL;
}
static void
-lmx_lm_link(const char *args, const char **unused)
+lmx_lm_link(const char* args, const char** unused)
{
urllink = xstrdup(args);
}
static void
-lmx_lm_linkt(const char *args, const char **unused)
+lmx_lm_linkt(const char* args, const char** unused)
{
urllinkt = xstrdup(args);
}
static void
-lmx_lm_mlink_e(const char *args, const char **unused)
+lmx_lm_mlink_e(const char* args, const char** unused)
{
waypt_add_url(wpt_tmp, urllink, urllinkt);
}
ff_vecs_t lmx_vecs = {
ff_type_file,
{
- ff_cap_read | ff_cap_write, /* waypoints */
+ (ff_cap)(ff_cap_read | ff_cap_write), /* waypoints */
ff_cap_none, /* tracks */
ff_cap_none /* routes */
},
typedef struct lowranceusr_icon_mapping {
const int value;
- const char *icon;
+ const char* icon;
} lowranceusr_icon_mapping_t;
#define DEF_ICON 10001
{ -1, NULL }
};
-static gbfile *file_in;
-static gbfile *file_out;
+static gbfile* file_in;
+static gbfile* file_out;
static short_handle mkshort_handle;
static unsigned short waypt_out_count;
static int trail_point_count;
static char continuous = 1;
static short num_section_points;
-static route_head *trk_head;
-static route_head *rte_head;
-static char *ignoreicons;
-static char *writeasicons;
-static char *merge;
-static char *seg_break;
-static char *wversion_arg;
+static route_head* trk_head;
+static route_head* rte_head;
+static char* ignoreicons;
+static char* writeasicons;
+static char* merge;
+static char* seg_break;
+static char* wversion_arg;
static int reading_version;
static int writing_version;
const time_t base_time_secs = 946706400;
static int
-lowranceusr_readstr(char *buf, const int maxlen, gbfile *file)
+lowranceusr_readstr(char* buf, const int maxlen, gbfile* file)
{
int org, len;
return len;
}
-const char *
+const char*
lowranceusr_find_desc_from_icon_number(const int icon)
{
- const lowranceusr_icon_mapping_t *i;
+ const lowranceusr_icon_mapping_t* i;
for (i = lowranceusr_icon_value_table; i->icon; i++) {
if (icon == i->value) {
}
int
-lowranceusr_find_icon_number_from_desc(const char *desc)
+lowranceusr_find_icon_number_from_desc(const char* desc)
{
- const lowranceusr_icon_mapping_t *i;
+ const lowranceusr_icon_mapping_t* i;
int n;
if (!desc) {
};
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
file_in = gbfopen_le(fname, "rb", MYNAME);
}
}
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
file_out = gbfopen_le(fname, "wb", MYNAME);
mkshort_handle = mkshort_new_handle();
}
static void
-lowranceusr_parse_waypt(waypoint *wpt_tmp)
+lowranceusr_parse_waypt(waypoint* wpt_tmp)
{
char buff[MAXUSRSTRINGSIZE + 1];
int text_len;
short int num_routes, num_legs;
int i,j;
int text_len;
- waypoint *wpt_tmp;
+ waypoint* wpt_tmp;
num_routes = gbfgetint16(file_in);
/* symbol */
(void) gbfread(&buff[0], 4, 1, file_in);
} else {
- waypoint *wpt_tmp;
+ waypoint* wpt_tmp;
wpt_tmp = waypt_new();
/* position coord lat & long */
short int num_trails, num_trail_points, num_section_points;
int i,j, trk_num, itmp;
int text_len;
- waypoint *wpt_tmp;
- route_head *trk_tmp;
+ waypoint* wpt_tmp;
+ route_head* trk_tmp;
/* num trails */
num_trails = gbfgetint16(file_in);
}
for (i = 0; i < NumWaypoints; i++) {
- waypoint *wpt_tmp;
+ waypoint* wpt_tmp;
wpt_tmp = waypt_new();
}
static void
-lowranceusr_waypt_disp(const waypoint *wpt)
+lowranceusr_waypt_disp(const waypoint* wpt)
{
int text_len, Lat, Lon, Time, SymbolId;
short int WayptType;
- char *name;
- char *comment;
+ char* name;
+ char* comment;
int alt = METERS_TO_FEET(wpt->altitude);
if (wpt->altitude == unknown_alt) {
}
static void
-lowranceusr_waypt_pr(const waypoint *wpt)
+lowranceusr_waypt_pr(const waypoint* wpt)
{
/* our personal waypoint counter */
* 4 bytes symbol
*/
static void
-lowranceusr_write_icon(const waypoint *wpt)
+lowranceusr_write_icon(const waypoint* wpt)
{
int latmm = lat_deg_to_mm(wpt->latitude);
int lonmm = lon_deg_to_mm(wpt->longitude);
*/
static void
-lowranceusr_track_hdr(const route_head *trk)
+lowranceusr_track_hdr(const route_head* trk)
{
int text_len;
- char *name, tmp_name[20];
+ char* name, tmp_name[20];
short num_trail_points, max_trail_size;
char visible=1;
}
static void
-lowranceusr_route_hdr(const route_head *rte)
+lowranceusr_route_hdr(const route_head* rte)
{
int text_len;
- char *name, tmp_name[20];
+ char* name, tmp_name[20];
short num_legs;
char route_reversed=0;
}
static void
-lowranceusr_track_disp(const waypoint *wpt)
+lowranceusr_track_disp(const waypoint* wpt)
{
int lat, lon;
}
static void
-lowranceusr_merge_track_hdr(const route_head *trk)
+lowranceusr_merge_track_hdr(const route_head* trk)
{
int text_len;
- char *name, tmp_name[20];
+ char* name, tmp_name[20];
if (++trail_count == 1) {
if (trk->rte_name) {
}
static void
-lowranceusr_merge_track_tlr(const route_head *trk)
+lowranceusr_merge_track_tlr(const route_head* trk)
{
short num_trail_points, max_trail_size;
char visible=1;
}
static void
-lowranceusr_merge_track_hdr_2(const route_head *trk)
+lowranceusr_merge_track_hdr_2(const route_head* trk)
{
continuous = 0;
}
#define PROUTE_MAGIC 0x766d6170 /* vmap */
#define PROUTE_ROUTE 0x49444154 /* IDAT */
-static pdbfile *file_in;
+static pdbfile* file_in;
static arglist_t magpdb_args[] = {
ARG_TERMINATOR
}
static void
-magpdb_read_data(const char *data, const size_t data_len)
+magpdb_read_data(const char* data, const size_t data_len)
{
- route_head *route;
- char *cin = (char *)data;
- char *cend = cin + data_len;
+ route_head* route;
+ char* cin = (char*)data;
+ char* cend = cin + data_len;
route = route_head_alloc();
route_add_head(route);
while (cin < cend) {
- char *lend;
+ char* lend;
int len;
lend = strchr(cin, '\x0A');
}
/* check, if line starts with time and distance */
else if (3 == sscanf(cin, "%d:%d %lf", &hour, &min, &distance)) {
- char *buff, *comma;
+ char* buff, *comma;
/* detect time-format settings, 12,0 or 12.0 */
comma = cin;
while ((comma = strchr(comma, separator))) {
int i, xlat, xlon;
- waypoint *wpt;
- char *cx;
+ waypoint* wpt;
+ char* cx;
comma++;
cx = strchr(comma, ')'); /* find tailing notes after the coordinates */
if (cx != NULL) {
- char *tail = lrtrim(++cx);
+ char* tail = lrtrim(++cx);
if (*tail != '\0') {
wpt->notes = xstrdup(tail);
}
* &&& gobal callbacks &&&
* ----------------------------------------------------------------------------------------- */
-static void magpdb_rd_init(const char *fname)
+static void magpdb_rd_init(const char* fname)
{
file_in = pdb_open(fname, MYNAME);
}
static void magpdb_read(void)
{
- pdbrec_t *pdb_rec;
+ pdbrec_t* pdb_rec;
is_fatal((file_in->creator != PROUTE_MAGIC), /* identify the database */
MYNAME ": Not a Map&Guide pdb file (0x%08x).", file_in->creator);
MYNAME ": Unknown pdb data type (0x%08x).", file_in->type);
for (pdb_rec = file_in->rec_list; pdb_rec; pdb_rec = pdb_rec->next) {
- char *data = (char *)pdb_rec->data;
+ char* data = (char*)pdb_rec->data;
if (be_read16(data) == 0) {
int len = be_read16(data + 2);
typedef struct pid_to_model {
meridian_model model;
int pid;
- const char *model_n;
+ const char* model_n;
} pid_to_model_t;
typedef struct icon_mapping {
- const char *token;
- const char *icon;
+ const char* token;
+ const char* icon;
} icon_mapping_t;
-const char * mag_find_descr_from_token(const char *token);
-const char * mag_find_token_from_descr(const char *icon);
+const char* mag_find_descr_from_token(const char* token);
+const char* mag_find_token_from_descr(const char* icon);
-unsigned int mag_checksum(const char *const buf);
-char * m330_cleanse(char *istring);
+unsigned int mag_checksum(const char* const buf);
+char* m330_cleanse(char* istring);
-waypoint * mag_trkparse(char *trkmsg);
-void mag_rteparse(char *rtemsg);
+waypoint* mag_trkparse(char* trkmsg);
+void mag_rteparse(char* rtemsg);
/* Turn this on (remove) after 5.2 becomes widespread. */
#define FIRMWARE_DOES_88591 0
-static gbfile *maggeofile_in;
-static gbfile *maggeofile_out;
+static gbfile* maggeofile_in;
+static gbfile* maggeofile_out;
static short_handle desc_handle = NULL;
-static time_t maggeo_parsedate(char *dmy);
+static time_t maggeo_parsedate(char* dmy);
static void
-maggeo_writemsg(const char * const buf)
+maggeo_writemsg(const char* const buf)
{
unsigned int osum = mag_checksum(buf);
gbfprintf(maggeofile_out, "$%s*%02X\r\n",buf, osum);
}
static void
-maggeo_rd_init(const char *fname)
+maggeo_rd_init(const char* fname)
{
maggeofile_in = gbfopen(fname, "rb", MYNAME);
}
}
static void
-maggeo_wr_init(const char *fname)
+maggeo_wr_init(const char* fname)
{
if (waypt_count() > 200) {
fatal(MYNAME ": eXplorist does not support more than 200 waypoints in one .gs file.\nDecrease the number of waypoints sent.\n");
static void
maggeo_read(void)
{
- char *buff;
+ char* buff;
while ((buff = gbfgetstr(maggeofile_in))) {
- waypoint *wpt_tmp;
- geocache_data *gcdata;
- char *s = NULL;
+ waypoint* wpt_tmp;
+ geocache_data* gcdata;
+ char* s = NULL;
int fld;
buff = lrtrim(buff);
* Note: returns allocated buffer that must be freed by caller.
*/
static
-char *
+char*
maggeo_fmtdate(time_t t)
{
#define SZ 16
- struct tm *tm = NULL;
+ struct tm* tm = NULL;
int date;
- char *cbuf = xmalloc(SZ);
+ char* cbuf = xmalloc(SZ);
cbuf[0] = '\0';
if (t > 0) {
* century is three digits but anything from before 2000, we'd have
* two digit years. This makes this easier to parse as strings.
*/
-static time_t maggeo_parsedate(char *dmy)
+static time_t maggeo_parsedate(char* dmy)
{
struct tm tm;
char dd[3];
*/
static
void
-append(char *buf, const char *str)
+append(char* buf, const char* str)
{
- char *cleansed1, *cleansed2;
+ char* cleansed1, *cleansed2;
strcat(buf, ",");
}
static void
-maggeo_waypt_pr(const waypoint *waypointp)
+maggeo_waypt_pr(const waypoint* waypointp)
{
char obuf[4096];
double ilon, ilat;
double lon, lat;
int lon_deg, lat_deg;
- char *shortname;
- char *cname = NULL;
- const char *ctype = NULL;
- char *placer = NULL;
- char *lfounddate = NULL;
- char *placeddate = NULL;
+ char* shortname;
+ char* cname = NULL;
+ const char* ctype = NULL;
+ char* placer = NULL;
+ char* lfounddate = NULL;
+ char* placeddate = NULL;
ilat = waypointp->latitude;
ilon = waypointp->longitude;
ff_vecs_t maggeo_vecs = {
ff_type_file,
- { ff_cap_read | ff_cap_write, ff_cap_none, ff_cap_none },
+ { (ff_cap)(ff_cap_read | ff_cap_write), ff_cap_none, ff_cap_none },
maggeo_rd_init,
maggeo_wr_init,
maggeo_rd_deinit,
char unknown3; /* always 'a' */
};
-static pdbfile *file_in;
-static pdbfile *file_out;
+static pdbfile* file_in;
+static pdbfile* file_out;
static short_handle mkshort_handle;
static int ct;
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
file_in = pdb_open(fname, MYNAME);
}
}
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
file_out = pdb_create(fname, MYNAME);
mkshort_handle = mkshort_new_handle();
static void
data_read(void)
{
- struct record *rec;
- pdbrec_t *pdb_rec;
+ struct record* rec;
+ pdbrec_t* pdb_rec;
if ((file_in->creator != MYCREATOR) || (file_in->type != MYTYPE)) {
fatal(MYNAME ": Not a Magellan Navigator file.\n");
}
for (pdb_rec = file_in->rec_list; pdb_rec; pdb_rec = pdb_rec->next) {
- waypoint *wpt_tmp;
- char *vdata;
+ waypoint* wpt_tmp;
+ char* vdata;
struct tm tm;
memset(&tm, 0, sizeof(tm));
wpt_tmp = waypt_new();
- rec = (struct record *) pdb_rec->data;
+ rec = (struct record*) pdb_rec->data;
wpt_tmp->altitude = be_read32(&rec->elevation);
wpt_tmp->longitude = be_read32(&rec->longitude) / 1e5;
wpt_tmp->latitude = be_read32(&rec->latitude) / 1e5;
- vdata = (char *) pdb_rec->data + sizeof(*rec);
+ vdata = (char*) pdb_rec->data + sizeof(*rec);
wpt_tmp->shortname = xstrdup(vdata);
vdata += strlen(vdata) + 1;
static void
-my_writewpt(const waypoint *wpt)
+my_writewpt(const waypoint* wpt)
{
- struct record *rec;
- struct tm *tm;
- char *vdata;
+ struct record* rec;
+ struct tm* tm;
+ char* vdata;
time_t tm_t;
- const char *sn = global_opts.synthesize_shortnames ?
+ const char* sn = global_opts.synthesize_shortnames ?
mkshort_from_wpt(mkshort_handle, wpt) :
wpt->shortname;
rec->plot = 0;
rec->unknown3 = 'a';
- vdata = (char *)rec + sizeof(*rec);
+ vdata = (char*)rec + sizeof(*rec);
if (sn) {
strncpy(vdata, sn, 21);
vdata[20] = '\0';
vdata[1] = '\0';
vdata += 2;
- pdb_write_rec(file_out, 0, 0, ct++, rec, (char *)vdata - (char *)rec);
+ pdb_write_rec(file_out, 0, 0, ct++, rec, (char*)vdata - (char*)rec);
xfree(rec);
}
static void
data_write(void)
{
- static char *appinfo =
+ static char* appinfo =
"\0\x01"
"User\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
file_out->type = MYTYPE; /* CWpt */
file_out->creator = MYCREATOR; /* cGPS */
file_out->version = 1;
- file_out->appinfo = (void *)appinfo;
+ file_out->appinfo = (void*)appinfo;
file_out->appinfo_len = 276;
waypt_disp_all(my_writewpt);
#define debug_serial (global_opts.debug_level > 1)
-static char *termread(char *ibuf, int size);
-static void termwrite(char *obuf, int size);
+static char* termread(char* ibuf, int size);
+static void termwrite(char* obuf, int size);
static void mag_readmsg(gpsdata_type objective);
static void mag_handon(void);
static void mag_handoff(void);
static short_handle mkshort_handle = NULL;
-static char *deficon = NULL;
-static char *bs = NULL;
-static char *cmts = NULL;
-static char *noack = NULL;
-static char *nukewpt = NULL;
+static char* deficon = NULL;
+static char* bs = NULL;
+static char* cmts = NULL;
+static char* noack = NULL;
+static char* nukewpt = NULL;
static int route_out_count;
static int waypoint_read_count;
static int wpt_len = 8;
-static const char *curfname;
+static const char* curfname;
static int extension_hint;
// For Explorist GC/510/610/710 familes, bludgeon in GPX support.
// (This has nothing to do with the Explorist 100...600 products.)
-static ff_vecs_t *gpx_vec;
-static mag_info *explorist_info;
-static char ** os_gpx_files(const char *dirname);
+static ff_vecs_t* gpx_vec;
+static mag_info* explorist_info;
+static char** os_gpx_files(const char* dirname);
/*
* Magellan's firmware is *horribly* slow to send the next packet after
*/
typedef struct mag_rte_elem {
queue Q; /* My link pointers */
- char *wpt_name;
- char *wpt_icon;
+ char* wpt_name;
+ char* wpt_icon;
} mag_rte_elem;
/*
*/
typedef struct mag_rte_head_ {
queue Q; /* Queue head for child rte_elems */
- char *rte_name;
+ char* rte_name;
int nelems;
} mag_rte_head;
static queue rte_wpt_tmp; /* temporary PGMNWPL msgs for routes */
-static gbfile *magfile_h;
+static gbfile* magfile_h;
static mag_rxstate magrxstate;
static int mag_error;
static unsigned int last_rx_csum;
static int found_done;
static int got_version;
static int is_file = 0;
-static route_head *trk_head;
+static route_head* trk_head;
static int ignore_unable;
-static waypoint * mag_wptparse(char *);
-typedef char * (cleanse_fn)(char *);
-static cleanse_fn *mag_cleanse;
-static const char ** os_get_magellan_mountpoints();
+static waypoint* mag_wptparse(char*);
+typedef char* (cleanse_fn)(char*);
+static cleanse_fn* mag_cleanse;
+static const char** os_get_magellan_mountpoints();
static icon_mapping_t gps315_icon_table[] = {
{ "a", "filled circle" },
{ mm_unknown, 0, NULL }
};
-static icon_mapping_t *icon_mapping = map330_icon_table;
+static icon_mapping_t* icon_mapping = map330_icon_table;
/*
* For each receiver type, return a "cleansed" version of the string
* that's valid for a waypoint name or comment. The string should be
* freed when you're done with it.
*/
-static char *
-m315_cleanse(char *istring)
+static char*
+m315_cleanse(char* istring)
{
- char *rstring = (char*) xmalloc(strlen(istring)+1);
- char *i,*o;
+ char* rstring = (char*) xmalloc(strlen(istring)+1);
+ char* i,*o;
static char m315_valid_chars[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789";
for (o=rstring,i=istring; *i; i++) {
/*
* Do same for 330, Meridian, and SportTrak.
*/
-char *
-m330_cleanse(char *istring)
+char*
+m330_cleanse(char* istring)
{
static char m330_valid_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ "
"abcdefghijklmnopqrstuvwxyz"
"0123456789+-.'/!@#<%^&>()=:\\";
- char *rstring = (char*) xmalloc(strlen(istring)+1);
- char *o, *i;
+ char* rstring = (char*) xmalloc(strlen(istring)+1);
+ char* o, *i;
for (o=rstring,i=istring; *i; i++) {
if (strchr(m330_valid_chars, *i)) {
* the Magellan protocol.
*/
unsigned int
-mag_checksum(const char * const buf)
+mag_checksum(const char* const buf)
{
int csum = 0;
- const char *p;
+ const char* p;
for (p = buf; *p; p++) {
csum ^= *p;
return csum;
}
static unsigned int
-mag_pchecksum(const char * const buf, int len)
+mag_pchecksum(const char* const buf, int len)
{
int csum = 0;
- const char *p = buf;
+ const char* p = buf;
for (; len ; len--) {
csum ^= *p++;
}
}
static void
-mag_writemsg(const char * const buf)
+mag_writemsg(const char* const buf)
{
unsigned int osum = mag_checksum(buf);
int retry_cnt = 5;
}
void
-mag_verparse(char *ibuf)
+mag_verparse(char* ibuf)
{
int prodid = mm_unknown;
char version[1024];
- pid_to_model_t *pp = pid_to_model;
+ pid_to_model_t* pp = pid_to_model;
got_version = 1;
sscanf(ibuf,"$PMGNVER,%d,%[^,]", &prodid, version);
of escaped FFFFFFFF) may need more size */
int isz;
unsigned int isum;
- char *isump;
- char *gr;
+ char* isump;
+ char* gr;
int retrycnt = 20;
retry:
return;
}
if (strncmp(ibuf, "$PMGNWPL,", 7) == 0) {
- waypoint *wpt = mag_wptparse(ibuf);
+ waypoint* wpt = mag_wptparse(ibuf);
waypoint_read_count++;
if (global_opts.verbose_status) {
waypt_status_disp(waypoint_read_count,
}
}
if (strncmp(ibuf, "$PMGNTRK,", 7) == 0) {
- waypoint *wpt = mag_trkparse(ibuf);
+ waypoint* wpt = mag_trkparse(ibuf);
/*
* Allow lazy allocation of track head.
*/
/* These tracks don't have names, so derive one
* from input filename.
*/
- char *e;
- const char *s = get_filename(curfname);
+ char* e;
+ const char* s = get_filename(curfname);
trk_head = route_head_alloc();
}
}
-static void *serial_handle = NULL;
+static void* serial_handle = NULL;
static int
-terminit(const char *portname, int create_ok)
+terminit(const char* portname, int create_ok)
{
if (gbser_is_serial(portname)) {
if (serial_handle = gbser_init(portname), NULL != serial_handle) {
}
}
-static char *termread(char *ibuf, int size)
+static char* termread(char* ibuf, int size)
{
if (is_file) {
return gbfgets(ibuf, size, magfile_h);
*/
static
void
-mag_dequote(char *ibuf)
+mag_dequote(char* ibuf)
{
- char *esc = NULL;
+ char* esc = NULL;
while ((esc = strchr(ibuf, 0x1b))) {
int nremains = strlen(esc);
if (nremains >= 3) {
static const char hex[17] = "0123456789ABCDEF";
- char *c1 = strchr(hex, esc[1]);
- char *c2 = strchr(hex, esc[2]);
+ char* c1 = strchr(hex, esc[1]);
+ char* c2 = strchr(hex, esc[2]);
if (c1 && c2) {
int escv = (c1 - hex) * 16 + (c2 - hex);
if (escv == 255) { /* corrupted data */
- char *tmp = esc + 1;
+ char* tmp = esc + 1;
while (*tmp == 'F') {
tmp++;
}
}
static void
-termwrite(char *obuf, int size)
+termwrite(char* obuf, int size)
{
if (is_file) {
size_t nw;
* The part of the serial init that's common to read and write.
*/
static void
-mag_serial_init_common(const char *portname)
+mag_serial_init_common(const char* portname)
{
time_t now, later;
}
static void
-mag_rd_init_common(const char *portname)
+mag_rd_init_common(const char* portname)
{
- char *ext;
+ char* ext;
waypoint_read_count = 0;
// For Explorist GC, intercept the device access and redirect to GPX.
// We actually do the rd_init() inside read as we may have multiple
// files that we have to read.
if (0 == strcmp(portname, "usb:")) {
- const char **dlist = os_get_magellan_mountpoints();
+ const char** dlist = os_get_magellan_mountpoints();
explorist_info = explorist_ini_get(dlist);
if (explorist_info) {
- char *vec_opts = NULL;
+ char* vec_opts = NULL;
gpx_vec = find_vec("gpx", &vec_opts);
}
return;
}
static void
-mag_rd_init(const char *portname)
+mag_rd_init(const char* portname)
{
explorist = 0;
suppress_ack = 1;
}
static void
-magX_rd_init(const char *portname)
+magX_rd_init(const char* portname)
{
explorist = 1;
mag_rd_init_common(portname);
}
static void
-mag_wr_init_common(const char *portname)
+mag_wr_init_common(const char* portname)
{
suppress_ack = 0;
if (bs) {
* Entry point for extended (explorist) points.
*/
static void
-magX_wr_init(const char *portname)
+magX_wr_init(const char* portname)
{
wpt_len = 20;
explorist = 1;
}
static void
-mag_wr_init(const char *portname)
+mag_wr_init(const char* portname)
{
explorist = 0;
wpt_len = 8;
static char ifield[20][100];
static
-void parse_istring(char *istring)
+void parse_istring(char* istring)
{
int f = 0;
int n,x;
while (istring[0]) {
- char *fp = ifield[f];
+ char* fp = ifield[f];
x = sscanf(istring, "%[^,]%n", fp, &n);
f++;
if (x) {
* $PMGNTRK,3605.259,N,08644.389,W,00151,M,201444.61,A,,020302*66
* create and return a populated waypoint.
*/
-waypoint *
-mag_trkparse(char *trkmsg)
+waypoint*
+mag_trkparse(char* trkmsg)
{
double latdeg, lngdeg;
int alt;
int hms;
int fracsecs;
struct tm tm;
- waypoint *waypt;
+ waypoint* waypt;
waypt = waypt_new();
* generate a route.
*/
void
-mag_rteparse(char *rtemsg)
+mag_rteparse(char* rtemsg)
{
char descr[100];
int n;
int frags,frag,rtenum;
char xbuf[100],next_stop[100],abuf[100];
- char *currtemsg;
- static mag_rte_head *mag_rte_head;
- mag_rte_elem *rte_elem;
- char *p;
- char *rte_name = NULL;
+ char* currtemsg;
+ static mag_rte_head* mag_rte_head;
+ mag_rte_elem* rte_elem;
+ char* p;
+ char* rte_name = NULL;
descr[0] = 0;
#if 0
/* Explorist has a route name here */
if (explorist) {
- char *ca, *ce;
+ char* ca, *ce;
ca = rtemsg + n;
is_fatal(*ca++ != ',', MYNAME ": Incorrectly formatted route line '%s'", rtemsg);
* gpsbabel internal structs now.
*/
if (frag == mag_rte_head->nelems) {
- queue *elem, *tmp;
- route_head *rte_head;
+ queue* elem, *tmp;
+ route_head* rte_head;
rte_head = route_head_alloc();
route_add_head(rte_head);
*/
QUEUE_FOR_EACH(&mag_rte_head->Q, elem, tmp) {
- mag_rte_elem *re = (mag_rte_elem *) elem;
- waypoint *waypt;
- queue *welem, *wtmp;
+ mag_rte_elem* re = (mag_rte_elem*) elem;
+ waypoint* waypt;
+ queue* welem, *wtmp;
/*
* Copy route points from temp wpt queue.
*/
QUEUE_FOR_EACH(&rte_wpt_tmp, welem, wtmp) {
- waypt = (waypoint *)welem;
+ waypt = (waypoint*)welem;
if (strcmp(waypt->shortname, re->wpt_name) == 0) {
- waypoint * wpt = waypt_dupe(waypt);
+ waypoint* wpt = waypt_dupe(waypt);
route_add_wpt(rte_head, wpt);
break;
}
}
}
-const char *
-mag_find_descr_from_token(const char *token)
+const char*
+mag_find_descr_from_token(const char* token)
{
- icon_mapping_t *i = icon_mapping;
+ icon_mapping_t* i = icon_mapping;
if (icon_mapping == NULL) {
return "unknown";
return icon_mapping[0].icon;
}
-const char *
-mag_find_token_from_descr(const char *icon)
+const char*
+mag_find_token_from_descr(const char* icon)
{
- icon_mapping_t *i = icon_mapping;
+ icon_mapping_t* i = icon_mapping;
if (i == NULL || icon == NULL) {
return "a";
* $PMGNWPL,3549.499,N,08650.827,W,0000257,M,HOME,HOME,c*4D
* create and return a populated waypoint.
*/
-static waypoint *
-mag_wptparse(char *trkmsg)
+static waypoint*
+mag_wptparse(char* trkmsg)
{
double latdeg, lngdeg;
char latdir;
char shortname[100];
char descr[256];
char icon_token[100];
- waypoint *waypt;
- char *icons;
- char *icone;
- char *blah;
+ waypoint* waypt;
+ char* icons;
+ char* icone;
+ char* blah;
int i = 0;
descr[0] = 0;
mag_read(void)
{
if (gpx_vec) {
- char **f = os_gpx_files(explorist_info->track_path);
+ char** f = os_gpx_files(explorist_info->track_path);
while (f && *f) {
gpx_vec->rd_init(*f);
gpx_vec->read();
static
void
-mag_waypt_pr(const waypoint *waypointp)
+mag_waypt_pr(const waypoint* waypointp)
{
double lon, lat;
double ilon, ilat;
int lon_deg, lat_deg;
char obuf[200];
char ofmtdesc[200];
- const char *icon_token=NULL;
- char *owpt;
- char *odesc;
- char *isrc = NULL;
+ const char* icon_token=NULL;
+ char* owpt;
+ char* odesc;
+ char* isrc = NULL;
ilat = waypointp->latitude;
ilon = waypointp->longitude;
isrc = waypointp->notes ? waypointp->notes : waypointp->description;
owpt = global_opts.synthesize_shortnames ?
mkshort_from_wpt(mkshort_handle, waypointp) : waypointp->shortname;
- odesc = isrc ? isrc : (char *)"";
+ odesc = isrc ? isrc : (char*)"";
owpt = mag_cleanse(owpt);
if (global_opts.smart_icons &&
}
static
-void mag_track_nop(const route_head *rte)
+void mag_track_nop(const route_head* rte)
{
return;
}
static
-void mag_track_disp(const waypoint *waypointp)
+void mag_track_disp(const waypoint* waypointp)
{
double ilon, ilat;
double lon, lat;
int hms=0;
int fracsec=0;
int date=0;
- struct tm *tm = NULL;
+ struct tm* tm = NULL;
ilat = waypointp->latitude;
ilon = waypointp->longitude;
*/
static void
-mag_route_trl(const route_head * rte)
+mag_route_trl(const route_head* rte)
{
- queue *elem, *tmp;
- waypoint *waypointp;
+ queue* elem, *tmp;
+ waypoint* waypointp;
char obuff[256];
char buff1[64], buff2[64];
- char *pbuff, *owpt;
- const char * icon_token;
+ char* pbuff, *owpt;
+ const char* icon_token;
int i, numlines, thisline;
/* count waypoints for this route */
thisline = i = 0;
QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) {
- waypointp = (waypoint *) elem;
+ waypointp = (waypoint*) elem;
i++;
if (deficon) {
}
static void
-mag_route_hdr(const route_head *rh)
+mag_route_hdr(const route_head* rh)
{
}
}
}
-const char ** os_get_magellan_mountpoints()
+const char** os_get_magellan_mountpoints()
{
#if __APPLE__
- const char **dlist = (const char**) xcalloc(2, sizeof *dlist);
+ const char** dlist = (const char**) xcalloc(2, sizeof *dlist);
dlist[0] = xstrdup("/Volumes/Magellan");
dlist[1] = NULL;
return dlist;
// My kingdom for container classes and portable tree-walking...
// Returns a pointer to a static vector that's valid until the next call.
-static char **
-os_gpx_files(const char *dirname)
+static char**
+os_gpx_files(const char* dirname)
{
#if HAVE_GLOB
static glob_t g;
- char *path;
+ char* path;
xasprintf(&path, "%s/*.gpx", dirname);
glob(path, 0, NULL, &g);
xfree(path);
typedef struct arg_stack_s {
int argn;
int argc;
- char **argv;
- struct arg_stack_s *prev;
+ char** argv;
+ struct arg_stack_s* prev;
} arg_stack_t;
static arg_stack_t
-*push_args(arg_stack_t *stack, const int argn, const int argc, char *argv[])
+*push_args(arg_stack_t* stack, const int argn, const int argc, char* argv[])
{
- arg_stack_t *res = (arg_stack_t *) xmalloc(sizeof(*res));
+ arg_stack_t* res = (arg_stack_t*) xmalloc(sizeof(*res));
res->prev = stack;
res->argn = argn;
res->argc = argc;
- res->argv = (char **)argv;
+ res->argv = (char**)argv;
return res;
}
static arg_stack_t
-*pop_args(arg_stack_t *stack, int *argn, int *argc, char **argv[])
+*pop_args(arg_stack_t* stack, int* argn, int* argc, char** argv[])
{
- arg_stack_t *res;
- char **argv2 = *argv;
+ arg_stack_t* res;
+ char** argv2 = *argv;
int i;
if (stack == NULL) {
}
static void
-load_args(const char *filename, int *argc, char **argv[])
+load_args(const char* filename, int* argc, char** argv[])
{
- gbfile *fin;
- char *str, *line = NULL;
+ gbfile* fin;
+ char* str, *line = NULL;
int argc2;
- char **argv2;
+ char** argv2;
fin = gbfopen(filename, "r", "main");
while ((str = gbfgetstr(fin))) {
if (line == NULL) {
line = xstrdup(str);
} else {
- char *tmp;
+ char* tmp;
xasprintf(&tmp, "%s %s", line, str);
xfree(line);
line = tmp;
}
gbfclose(fin);
- argv2 = (char **) xmalloc(2 * sizeof(*argv2));
+ argv2 = (char**) xmalloc(2 * sizeof(*argv2));
argv2[0] = xstrdup(*argv[0]);
argc2 = 1;
str = csv_lineparse(line, " ", "\"", 0);
while (str != NULL) {
- argv2 = (char **) xrealloc(argv2, (argc2 + 2) * sizeof(*argv2));
+ argv2 = (char**) xrealloc(argv2, (argc2 + 2) * sizeof(*argv2));
argv2[argc2] = xstrdup(str);
argc2++;
str = csv_lineparse(NULL, " ", "\"", 0);
}
static void
-usage(const char *pname, int shorter)
+usage(const char* pname, int shorter)
{
printf("GPSBabel Version %s. http://www.gpsbabel.org\n\n",
gpsbabel_version);
}
static void
-spec_usage(const char *vec)
+spec_usage(const char* vec)
{
printf("\n");
disp_vec(vec);
}
int
-main(int argc, char *argv[])
+main(int argc, char* argv[])
{
int c;
int argn;
- ff_vecs_t *ivecs = NULL;
- ff_vecs_t *ovecs = NULL;
- filter_vecs_t *fvecs = NULL;
- char *fname = NULL;
- char *ofname = NULL;
- char *ivec_opts = NULL;
- char *ovec_opts = NULL;
- char *fvec_opts = NULL;
+ ff_vecs_t* ivecs = NULL;
+ ff_vecs_t* ovecs = NULL;
+ filter_vecs_t* fvecs = NULL;
+ char* fname = NULL;
+ char* ofname = NULL;
+ char* ivec_opts = NULL;
+ char* ovec_opts = NULL;
+ char* fvec_opts = NULL;
int opt_version = 0;
int did_something = 0;
- const char *prog_name = argv[0]; /* argv is modified during processing */
- queue *wpt_head_bak, *rte_head_bak, *trk_head_bak; /* #ifdef UTF8_SUPPORT */
+ const char* prog_name = argv[0]; /* argv is modified during processing */
+ queue* wpt_head_bak, *rte_head_bak, *trk_head_bak; /* #ifdef UTF8_SUPPORT */
signed int wpt_ct_bak, rte_ct_bak, trk_ct_bak; /* #ifdef UTF8_SUPPORT */
- arg_stack_t *arg_stack = NULL;
+ arg_stack_t* arg_stack = NULL;
global_opts.objective = wptdata;
global_opts.masked_objective = NOTHINGMASK; /* this makes the default mask behaviour slightly different */
*/
argn = 1;
while (argn < argc) {
- char *optarg;
+ char* optarg;
if (argv[argn][0] != '-') {
break;
tracking_status.request_terminate = 0;
while (!tracking_status.request_terminate) {
- waypoint *wpt;
+ waypoint* wpt;
wpt = ivecs->position_ops.rd_position(&tracking_status);
#define TR7_S_VALID 28
#define TR7_S_FIX 29
-static gbfile *fin, *fout;
-static const waypoint *wpt_tmp;
-static const route_head *trk_tmp;
+static gbfile* fin, *fout;
+static const waypoint* wpt_tmp;
+static const route_head* trk_tmp;
static int course_tmp, speed_tmp;
struct tm tmref;
*******************************************************************************/
static void
-tr7_rd_init(const char *fname)
+tr7_rd_init(const char* fname)
{
fin = gbfopen_le(fname, "rb", MYNAME);
tmref = *gmtime(&gpsbabel_now);
static void
tr7_read(void)
{
- route_head *trk = NULL;
+ route_head* trk = NULL;
unsigned int magic;
- waypoint *prev = NULL;
+ waypoint* prev = NULL;
magic = gbfgetint32(fin);
if (magic != TR7_TRACK_MAGIC) {
unsigned char buff[TR7_S_SIZE];
double lat, lon;
struct tm tm;
- waypoint *wpt;
+ waypoint* wpt;
float speed, course;
gbfread(buff, 1, sizeof(buff), fin);
}
static void
-tr7_check_after_read_head_cb(const route_head *trk)
+tr7_check_after_read_head_cb(const route_head* trk)
{
trk_tmp = trk;
course_tmp = 0;
}
static void
-tr7_check_after_read_wpt_cb(const waypoint *wpt)
+tr7_check_after_read_wpt_cb(const waypoint* wpt)
{
if (wpt->speed != 0) {
speed_tmp = 1;
}
static void
-tr7_check_after_read_trailer_cb(const route_head *trk)
+tr7_check_after_read_trailer_cb(const route_head* trk)
{
- queue *elem, *tmp;
- QUEUE_FOR_EACH((queue *)&trk->waypoint_list, elem, tmp) {
- waypoint *wpt = (waypoint *)elem;
+ queue* elem, *tmp;
+ QUEUE_FOR_EACH((queue*)&trk->waypoint_list, elem, tmp) {
+ waypoint* wpt = (waypoint*)elem;
if (speed_tmp == 0) {
WAYPT_UNSET(wpt, speed);
}
*******************************************************************************/
static void
-tr7_disp_track_head_cb(const route_head *trk)
+tr7_disp_track_head_cb(const route_head* trk)
{
wpt_tmp = NULL;
}
static void
-tr7_disp_waypt_cb(const waypoint *wpt)
+tr7_disp_waypt_cb(const waypoint* wpt)
{
unsigned char buff[TR7_S_SIZE];
struct tm tm;
}
static void
-tr7_wr_init(const char *fname)
+tr7_wr_init(const char* fname)
{
fout = gbfopen_le(fname, "wb", MYNAME);
gbfputint32(TR7_TRACK_MAGIC, fout);
ff_type_file,
{
ff_cap_none /* waypoints */,
- ff_cap_read | ff_cap_write /* tracks */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */,
ff_cap_none /* routes */
},
tr7_rd_init,
pdb_16 lat2d;
};
-static pdbfile *file_in, *file_out;
+static pdbfile* file_in, *file_out;
static short_handle mkshort_handle;
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
file_in = pdb_open(fname, MYNAME);
}
}
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
file_out = pdb_create(fname, MYNAME);
mkshort_handle = mkshort_new_handle();
mkshort_del_handle(&mkshort_handle);
}
-convert_rec0(struct record0 *rec0)
+convert_rec0(struct record0* rec0)
{
Lon1 = be_read32(&rec0->lon1) / LONDIV;
Lat1 = be_read32(&rec0->lat1) / LATDIV;
* * Decode the information field
* */
void
-decode(char *buf)
+decode(char* buf)
{
int i;
static void
data_read(void)
{
- struct record *rec;
- pdbrec_t *pdb_rec;
+ struct record* rec;
+ pdbrec_t* pdb_rec;
if ((file_in->creator != MYCREATOR) || (file_in->type != MYTYPE)) {
fatal(MYNAME ": Not a Magellan Navigator file.\n");
// for(pdb_rec = pdb->rec_index.rec; pdb_rec; pdb_rec=pdb_rec->next) {
for (pdb_rec = pdb_rec->next; pdb_rec; pdb_rec=pdb_rec->next) {
- waypoint *wpt_tmp;
- char *vdata = 0;
- char *edata;
+ waypoint* wpt_tmp;
+ char* vdata = 0;
+ char* edata;
struct tm tm = {0};
- rec = (struct record *) pdb_rec->data;
- edata = (char *) rec + pdb_rec->size;
+ rec = (struct record*) pdb_rec->data;
+ edata = (char*) rec + pdb_rec->size;
- for (; vdata < edata; rec = (struct record *) vdata) {
+ for (; vdata < edata; rec = (struct record*) vdata) {
wpt_tmp = waypt_new();
wpt_tmp->latitude = Lat1 +
be_read16(&rec->lat1d) / LATDIV2;
wpt_tmp->longitude = Lon1 +
be_read16(&rec->lon1d) / LONDIV2;
- vdata = (char *) rec + sizeof(*rec);
+ vdata = (char*) rec + sizeof(*rec);
wpt_tmp->description = xstrdup(vdata);
vdata += strlen(wpt_tmp->description) + 1 + 6;
static void
-my_writewpt(const waypoint *wpt)
+my_writewpt(const waypoint* wpt)
{
#if 0
- struct record *rec;
+ struct record* rec;
static int ct;
- struct tm *tm;
- char *vdata;
+ struct tm* tm;
+ char* vdata;
time_t tm_t;
- const char *sn = global_opts.synthesize_shortnames ?
+ const char* sn = global_opts.synthesize_shortnames ?
mkshort(mkshort_handle, wpt->description) :
wpt->shortname;
rec->plot = 0;
rec->unknown3 = 'a';
- vdata = (char *)rec + sizeof(*rec);
+ vdata = (char*)rec + sizeof(*rec);
if (sn) {
strncpy(vdata, sn, 21);
vdata[20] = '\0';
vdata[1] = '\0';
vdata += 2;
- pdb_write(file_out, 0, rec, (char *)vdata - (char *)rec);
+ pdb_write(file_out, 0, rec, (char*)vdata - (char*)rec);
xfree(rec);
#endif
static void
data_write(void)
{
- static char *appinfo =
+ static char* appinfo =
"\0\x01"
"User\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
file_out->type = MYTYPE; /* CWpt */
file_out->creator = MYCREATOR; /* cGPS */
file_out->version = 1;
- file_out->appinfo = (void *)appinfo;
+ file_out->appinfo = (void*)appinfo;
file_out->appinfo_len = 276;
waypt_disp_all(my_writewpt);
#include "mapsend.h"
#include "magellan.h"
-static gbfile *mapsend_file_in;
-static gbfile *mapsend_file_out;
+static gbfile* mapsend_file_in;
+static gbfile* mapsend_file_out;
static short_handle mkshort_handle;
static short_handle wpt_handle;
#define MYNAME "mapsend"
-static char *mapsend_opt_trkver = NULL;
+static char* mapsend_opt_trkver = NULL;
#define MAPSEND_TRKVER_MIN 3
#define MAPSEND_TRKVER_MAX 4
}
static void
-mapsend_rd_init(const char *fname)
+mapsend_rd_init(const char* fname)
{
mapsend_init_opts(1);
mapsend_file_in = gbfopen_le(fname, "rb", MYNAME);
}
static void
-mapsend_wr_init(const char *fname)
+mapsend_wr_init(const char* fname)
{
mapsend_init_opts(0);
mapsend_file_out = gbfopen(fname, "wb", MYNAME);
int wpt_number;
char wpt_icon;
char wpt_status;
- waypoint *wpt_tmp;
- route_head *rte_head;
+ waypoint* wpt_tmp;
+ route_head* rte_head;
wpt_count = gbfgetint32(mapsend_file_in);
unsigned int trk_count;
int valid;
unsigned char centisecs;
- route_head *track_head;
- waypoint *wpt_tmp;
+ route_head* track_head;
+ waypoint* wpt_tmp;
track_head = route_head_alloc();
track_head->rte_name = gbfgetpstr(mapsend_file_in);
static void
-mapsend_waypt_pr(const waypoint *waypointp)
+mapsend_waypt_pr(const waypoint* waypointp)
{
unsigned char c;
double falt;
static int cnt = 0;
- const char *iconp = NULL;
- const char *sn = global_opts.synthesize_shortnames ?
+ const char* iconp = NULL;
+ const char* sn = global_opts.synthesize_shortnames ?
mkshort_from_wpt(mkshort_handle, waypointp) :
waypointp->shortname;
- char *tmp;
+ char* tmp;
/*
* The format spec doesn't call out the character set of waypoint
}
static void
-mapsend_route_hdr(const route_head *rte)
+mapsend_route_hdr(const route_head* rte)
{
- char * rname;
+ char* rname;
/* route name -- mapsend really seems to want something here.. */
if (!rte->rte_name) {
}
static void
-mapsend_noop(const route_head *wp)
+mapsend_noop(const route_head* wp)
{
/* no-op */
}
static void
-mapsend_route_disp(const waypoint *waypointp)
+mapsend_route_disp(const waypoint* waypointp)
{
unsigned char c;
- const char *iconp;
+ const char* iconp;
route_wp_count++;
gbfwrite(&c, 1, 1, mapsend_file_out);
}
-void mapsend_track_hdr(const route_head * trk)
+void mapsend_track_hdr(const route_head* trk)
{
/*
* we write mapsend v3.0 tracks as mapsend v2.0 tracks get
* tremendously out of whack time/date wise.
*/
- char *verstring = "30";
- queue *elem, *tmp;
- char *tname;
+ char* verstring = "30";
+ queue* elem, *tmp;
+ char* tname;
int i;
mapsend_hdr hdr = {13, "4D533334 MS", "30", ms_type_track, {0, 0, 0}};
}
-void mapsend_track_disp(const waypoint * wpt)
+void mapsend_track_disp(const waypoint* wpt)
{
unsigned char c;
int t;
#include "jeeps/gpsmath.h"
#include <ctype.h>
-static gbfile *mps_file_in;
-static gbfile *mps_file_out;
-static gbfile *mps_file_temp;
+static gbfile* mps_file_in;
+static gbfile* mps_file_out;
+static gbfile* mps_file_temp;
static short_handle mkshort_handle;
static int mps_ver_in = 0;
static int mps_ver_temp = 0;
/* Temporary pathname used when merging gpsbabel output with an existing file */
-static char *tempname;
-static char *fin_name;
+static char* tempname;
+static char* fin_name;
-static const waypoint *prevRouteWpt;
+static const waypoint* prevRouteWpt;
/* Private queues of written out waypoints */
static queue written_wpt_head;
static queue written_route_wpt_head;
#define MPSDESCBUFFERLEN 4096
-char *snlen = NULL;
-char *snwhiteopt = NULL;
-char *mpsverout = NULL;
-char *mpsmergeouts = NULL;
+char* snlen = NULL;
+char* snwhiteopt = NULL;
+char* mpsverout = NULL;
+char* mpsmergeouts = NULL;
int mpsmergeout;
-char *mpsusedepth = NULL;
-char *mpsuseprox = NULL;
+char* mpsusedepth = NULL;
+char* mpsuseprox = NULL;
static
arglist_t mps_args[] = {
};
static void
-mps_noop(const route_head *wp)
+mps_noop(const route_head* wp)
{
/* no-op */
}
void
-mps_wpt_q_init(queue *whichQueue)
+mps_wpt_q_init(queue* whichQueue)
{
QUEUE_INIT(whichQueue);
}
void
-mps_wpt_q_deinit(queue *whichQueue)
+mps_wpt_q_deinit(queue* whichQueue)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
QUEUE_FOR_EACH(whichQueue, elem, tmp) {
- waypoint *q = (waypoint *) dequeue(elem);
+ waypoint* q = (waypoint*) dequeue(elem);
waypt_free(q);
}
}
* Find a waypoint that we've already written out
*
*/
-waypoint *
-mps_find_wpt_q_by_name(const queue *whichQueue, const char *name)
+waypoint*
+mps_find_wpt_q_by_name(const queue* whichQueue, const char* name)
{
- queue *elem, *tmp;
- waypoint *waypointp;
+ queue* elem, *tmp;
+ waypoint* waypointp;
QUEUE_FOR_EACH(whichQueue, elem, tmp) {
- waypointp = (waypoint *) elem;
+ waypointp = (waypoint*) elem;
if (0 == strcmp(waypointp->shortname, name)) {
return waypointp;
}
*
*/
void
-mps_wpt_q_add(const queue *whichQueue, const waypoint *wpt)
+mps_wpt_q_add(const queue* whichQueue, const waypoint* wpt)
{
- waypoint *written_wpt = waypt_dupe(wpt);
+ waypoint* written_wpt = waypt_dupe(wpt);
ENQUEUE_TAIL(whichQueue, &written_wpt->Q);
}
}
static void
-mps_rd_init(const char *fname)
+mps_rd_init(const char* fname)
{
mps_file_in = gbfopen_le(fname, "rb", MYNAME);
}
static void
-mps_wr_init(const char *fname)
+mps_wr_init(const char* fname)
{
fin_name = xstrdup(fname);
if (mpsmergeouts) {
* and write into buf.
*/
static void
-mps_readstr(gbfile *mps_file, char *buf, size_t sz)
+mps_readstr(gbfile* mps_file, char* buf, size_t sz)
{
int c;
while (sz-- && (c = gbfgetc(mps_file)) != EOF) {
* MRCB
*/
static void
-mps_fileHeader_r(gbfile *mps_file, int *mps_ver)
+mps_fileHeader_r(gbfile* mps_file, int* mps_ver)
{
char hdr[100];
int reclen;
* MRCB
*/
static void
-mps_fileHeader_w(gbfile *mps_file, int mps_ver)
+mps_fileHeader_w(gbfile* mps_file, int mps_ver)
{
char hdr[100];
int reclen;
* MRCB
*/
static void
-mps_mapsegment_r(gbfile *mps_file, int mps_ver)
+mps_mapsegment_r(gbfile* mps_file, int mps_ver)
{
int reclen;
* MRCB
*/
static void
-mps_mapsetname_r(gbfile *mps_file, int mps_ver)
+mps_mapsetname_r(gbfile* mps_file, int mps_ver)
{
int reclen;
* MRCB
*/
static void
-mps_mapsetname_w(gbfile *mps_file, int mps_ver)
+mps_mapsetname_w(gbfile* mps_file, int mps_ver)
{
char hdr[100];
int reclen;
* MRCB
*/
static void
-mps_waypoint_r(gbfile *mps_file, int mps_ver, waypoint **wpt, unsigned int *mpsclass)
+mps_waypoint_r(gbfile* mps_file, int mps_ver, waypoint** wpt, unsigned int* mpsclass)
{
char tbuf[100];
char wptname[MPSNAMEBUFFERLEN];
- char *wptdesc = NULL;
- char *wptnotes = NULL;
+ char* wptdesc = NULL;
+ char* wptnotes = NULL;
int lat;
int lon;
int icon;
int dynamic;
- waypoint *thisWaypoint = NULL;
+ waypoint* thisWaypoint = NULL;
double mps_altitude = unknown_alt;
double mps_proximity = unknown_alt;
double mps_depth = unknown_alt;
* MRCB
*/
static void
-mps_waypoint_w(gbfile *mps_file, int mps_ver, const waypoint *wpt, const int isRouteWpt)
+mps_waypoint_w(gbfile* mps_file, int mps_ver, const waypoint* wpt, const int isRouteWpt)
{
int reclen;
int lat, lon;
int icon;
- char *src = ""; /* default to empty string */
- char *ident;
- char *ascii_description;
+ char* src = ""; /* default to empty string */
+ char* ident;
+ char* ascii_description;
char zbuf[25];
char ffbuf[25];
int display = 1;
*
*/
static void
-mps_waypoint_w_unique_wrapper(const waypoint *wpt)
+mps_waypoint_w_unique_wrapper(const waypoint* wpt)
{
- waypoint *wptfound = NULL;
+ waypoint* wptfound = NULL;
/* Search for this waypoint in the ones already written */
wptfound = mps_find_wpt_q_by_name(&written_wpt_head, wpt->shortname);
*
*/
static void
-mps_route_wpt_w_unique_wrapper(const waypoint *wpt)
+mps_route_wpt_w_unique_wrapper(const waypoint* wpt)
{
- waypoint *wptfound = NULL;
+ waypoint* wptfound = NULL;
/* Search for this waypoint in the ones already written */
wptfound = mps_find_wpt_q_by_name(&written_wpt_head, wpt->shortname);
*
*/
static void
-mps_waypoint_w_uniqloc_wrapper(waypoint *wpt)
+mps_waypoint_w_uniqloc_wrapper(waypoint* wpt)
{
- waypoint *wptfound = NULL;
- char *newName;
+ waypoint* wptfound = NULL;
+ char* newName;
/* Search for this waypoint in the ones already written */
wptfound = mps_find_wpt_q_by_name(&written_wpt_head, wpt->shortname);
* MRCB
*/
static void
-mps_route_r(gbfile *mps_file, int mps_ver, route_head **rte)
+mps_route_r(gbfile* mps_file, int mps_ver, route_head** rte)
{
char tbuf[100];
- char *rtename;
+ char* rtename;
char wptname[MPSNAMEBUFFERLEN];
int lat = 0;
int lon = 0;
int thisInterlinkStep;
unsigned int mpsclass;
- route_head *rte_head;
+ route_head* rte_head;
int rte_count;
- waypoint *thisWaypoint;
- waypoint *tempWpt;
+ waypoint* thisWaypoint;
+ waypoint* tempWpt;
double mps_altitude = unknown_alt;
double mps_depth = unknown_alt;
* MRCB
*/
static void
-mps_routehdr_w(gbfile *mps_file, int mps_ver, const route_head *rte)
+mps_routehdr_w(gbfile* mps_file, int mps_ver, const route_head* rte)
{
unsigned int reclen;
unsigned int rte_datapoints;
int rname_len;
- char *rname;
+ char* rname;
char hdr[20];
char zbuf[20];
- char *src = "";
- char *ident;
+ char* src = "";
+ char* ident;
- waypoint *testwpt;
+ waypoint* testwpt;
time_t uniqueValue = 0;
int allWptNameLengths;
int lat;
int lon;
- queue *elem, *tmp;
+ queue* elem, *tmp;
prevRouteWpt = NULL; /* clear the stateful flag used to know when the start of route wpts happens */
if (rte->waypoint_list.next) { /* this test doesn't do what I want i.e test if this is a valid route - treat as a placeholder for now */
QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) {
- testwpt = (waypoint *)elem;
+ testwpt = (waypoint*)elem;
if (rte_datapoints == 0) {
uniqueValue = testwpt->creation_time;
}
}
static void
-mps_routehdr_w_wrapper(const route_head *rte)
+mps_routehdr_w_wrapper(const route_head* rte)
{
mps_routehdr_w(mps_file_out, mps_ver_out, rte);
}
* MRCB
*/
static void
-mps_routedatapoint_w(gbfile *mps_file, int mps_ver, const waypoint *rtewpt)
+mps_routedatapoint_w(gbfile* mps_file, int mps_ver, const waypoint* rtewpt)
{
int lat;
int lon;
char zbuf[20];
char ffbuf[20];
- char *src = "";
- char *ident;
+ char* src = "";
+ char* ident;
int reclen;
int maxlat;
double minalt=-unknown_alt;
double mps_altitude;
- waypoint *wptfound;
+ waypoint* wptfound;
memset(zbuf, 0, sizeof(zbuf));
memset(ffbuf, 0xff, sizeof(ffbuf));
}
static void
-mps_routedatapoint_w_wrapper(const waypoint *rte)
+mps_routedatapoint_w_wrapper(const waypoint* rte)
{
mps_routedatapoint_w(mps_file_out, mps_ver_out, rte);
}
* MRCB
*/
static void
-mps_routetrlr_w(gbfile *mps_file, int mps_ver, const route_head *rte)
+mps_routetrlr_w(gbfile* mps_file, int mps_ver, const route_head* rte)
{
char hdr[2];
int value = 0;
}
static void
-mps_routetrlr_w_wrapper(const route_head *rte)
+mps_routetrlr_w_wrapper(const route_head* rte)
{
mps_routetrlr_w(mps_file_out, mps_ver_out, rte);
}
* MRCB
*/
static void
-mps_track_r(gbfile *mps_file, int mps_ver, route_head **trk)
+mps_track_r(gbfile* mps_file, int mps_ver, route_head** trk)
{
- char *trkname;
+ char* trkname;
int lat;
int lon;
int dateTime = 0;
- route_head *track_head;
+ route_head* track_head;
int trk_count;
- waypoint *thisWaypoint;
+ waypoint* thisWaypoint;
double mps_altitude = unknown_alt;
double mps_depth = unknown_alt;
* MRCB
*/
static void
-mps_trackhdr_w(gbfile *mps_file, int mps_ver, const route_head *trk)
+mps_trackhdr_w(gbfile* mps_file, int mps_ver, const route_head* trk)
{
unsigned int reclen;
unsigned int trk_datapoints;
unsigned int colour = 0; /* unknown colour */
int tname_len;
- char *tname;
+ char* tname;
char hdr[20];
- waypoint *testwpt;
+ waypoint* testwpt;
time_t uniqueValue = 0;
- queue *elem, *tmp;
+ queue* elem, *tmp;
/* total nodes (waypoints) this track */
trk_datapoints = 0;
if (trk->waypoint_list.next) { /* this test doesn't do what I want i.e test if this is a valid track - treat as a placeholder for now */
QUEUE_FOR_EACH(&trk->waypoint_list, elem, tmp) {
if (trk_datapoints == 0) {
- testwpt = (waypoint *)elem;
+ testwpt = (waypoint*)elem;
uniqueValue = testwpt->creation_time;
}
trk_datapoints++;
}
static void
-mps_trackhdr_w_wrapper(const route_head *trk)
+mps_trackhdr_w_wrapper(const route_head* trk)
{
mps_trackhdr_w(mps_file_out, mps_ver_out, trk);
}
* MRCB
*/
static void
-mps_trackdatapoint_w(gbfile *mps_file, int mps_ver, const waypoint *wpt)
+mps_trackdatapoint_w(gbfile* mps_file, int mps_ver, const waypoint* wpt)
{
int lat, lon;
time_t t = wpt->creation_time;
}
static void
-mps_trackdatapoint_w_wrapper(const waypoint *wpt)
+mps_trackdatapoint_w_wrapper(const waypoint* wpt)
{
mps_trackdatapoint_w(mps_file_out, mps_ver_out, wpt);
}
static void
mps_read(void)
{
- waypoint *wpt;
- route_head *rte;
- route_head *trk;
+ waypoint* wpt;
+ route_head* rte;
+ route_head* trk;
char recType;
int reclen;
mps_write(void)
{
int short_length;
- waypoint *wpt;
- route_head *rte;
- route_head *trk;
+ waypoint* wpt;
+ route_head* rte;
+ route_head* trk;
char recType;
int reclen;
fatal(MYNAME ": merge source version is %d, requested out version is %d\n", mps_ver_temp, atoi(mpsverout));
}
} else {
- mpsverout = (char *) xmalloc(10);
+ mpsverout = (char*) xmalloc(10);
sprintf(mpsverout,"%d", mps_ver_temp);
}
}
tbl_ent(int n, ...)
{
int i;
- char *t;
+ char* t;
va_list args;
va_start(args, n);
#if 0
for (i = 0; i < n; i++) {
- t = va_arg(args, char *);
+ t = va_arg(args, char*);
printf("%s%s", i > 0 ? "," : "", t);
}
}
#include "garmin_tables.c"
-sort_garmin(const void *a, const void *b)
+sort_garmin(const void* a, const void* b)
{
- const icon_mapping_t *ap = a;
- const icon_mapping_t *bp = b;
+ const icon_mapping_t* ap = a;
+ const icon_mapping_t* bp = b;
return (case_ignore_strcmp((ap)->icon, (bp)->icon));
}
garmin()
{
- icon_mapping_t *i;
+ icon_mapping_t* i;
int n = 0;
char pbuf[100];
char mbuf[100];
static const char vowels[] = "aeiouAEIOU";
#define DEFAULT_TARGET_LEN 8
-static const char *DEFAULT_BADCHARS = "\"$.,'!-";
+static const char* DEFAULT_BADCHARS = "\"$.,'!-";
/*
* Hash table tunings. The reality is that our hash doesn't have to be
typedef struct {
queue list;
- char *orig_shortname;
+ char* orig_shortname;
int conflictctr;
} uniq_shortname;
static struct replacements {
- const char *orig;
- const char *replacement;
+ const char* orig;
+ const char* replacement;
} replacements[] = {
{"zero", "0"},
{"one", "1"},
/*
* We hash all strings as upper case.
*/
-unsigned int hash_string(const char *key)
+unsigned int hash_string(const char* key)
{
unsigned int hash = 0;
while (*key) {
#endif
{
int i;
- mkshort_handle_imp *h = (mkshort_handle_imp *) xxcalloc(sizeof *h, 1, file, line);
+ mkshort_handle_imp* h = (mkshort_handle_imp*) xxcalloc(sizeof *h, 1, file, line);
for (i = 0; i < PRIME; i++) {
QUEUE_INIT(&h->namelist[i]);
}
static
-uniq_shortname *
-is_unique(mkshort_handle_imp *h, char *name)
+uniq_shortname*
+is_unique(mkshort_handle_imp* h, char* name)
{
- queue *e, *t;
+ queue* e, *t;
int hash;
hash = hash_string(name);
QUEUE_FOR_EACH(&h->namelist[hash], e, t) {
- uniq_shortname *z = (uniq_shortname *) e;
+ uniq_shortname* z = (uniq_shortname*) e;
if (0 == case_ignore_strcmp(z->orig_shortname, name)) {
return z;
}
}
- return (uniq_shortname *) NULL;
+ return (uniq_shortname*) NULL;
}
static
void
-add_to_hashlist(mkshort_handle_imp *h, char *name)
+add_to_hashlist(mkshort_handle_imp* h, char* name)
{
int hash = hash_string(name);
- uniq_shortname *s = (uniq_shortname*) xcalloc(1, sizeof(uniq_shortname));
+ uniq_shortname* s = (uniq_shortname*) xcalloc(1, sizeof(uniq_shortname));
s->orig_shortname = xstrdup(name);
ENQUEUE_TAIL(&h->namelist[hash], &s->list);
}
-char *
-mkshort_add_to_list(mkshort_handle_imp *h, char *name)
+char*
+mkshort_add_to_list(mkshort_handle_imp* h, char* name)
{
- uniq_shortname *s;
+ uniq_shortname* s;
while ((s = is_unique(h, name))) {
int dl;
dl = sprintf(tbuf, ".%d", s->conflictctr);
if (l + dl < h->target_len) {
- name = (char *) xrealloc(name, l + dl + 1);
+ name = (char*) xrealloc(name, l + dl + 1);
strcat(name, tbuf);
} else {
strcpy(&name[l-dl], tbuf);
}
void
-mkshort_del_handle(short_handle *h)
+mkshort_del_handle(short_handle* h)
{
- mkshort_handle_imp *hdr = (mkshort_handle_imp*) *h;
+ mkshort_handle_imp* hdr = (mkshort_handle_imp*) *h;
int i;
if (!h || !hdr) {
}
for (i = 0; i < PRIME; i++) {
- queue *e, *t;
+ queue* e, *t;
QUEUE_FOR_EACH(&hdr->namelist[i], e, t) {
- uniq_shortname *s = (uniq_shortname *) e;
+ uniq_shortname* s = (uniq_shortname*) e;
#if 0
if (global_opts.verbose_status >= 2 && s->conflictctr) {
fprintf(stderr, "%d Output name conflicts: '%s'\n",
*/
static
-char *
-delete_last_vowel(int start, char *istring, int *replaced)
+char*
+delete_last_vowel(int start, char* istring, int* replaced)
{
int l;
*replaced = 0;
for (l = strlen(istring); l > start; l--) {
if (strchr(vowels, istring[l-1])) {
- char *ostring;
+ char* ostring;
/* If vowel is the first letter of a word, keep it.*/
if (istring[l-2] == ' ') {
continue;
* are made only at the end of the string.
*/
void
-replace_constants(char *s)
+replace_constants(char* s)
{
- struct replacements *r;
+ struct replacements* r;
int origslen = strlen(s);
for (r = replacements; r->orig; r++) {
void
setshort_length(short_handle h, int l)
{
- mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
+ mkshort_handle_imp* hdl = (mkshort_handle_imp*) h;
if (l == 0) {
hdl->target_len = DEFAULT_TARGET_LEN;
} else {
void
setshort_whitespace_ok(short_handle h, int l)
{
- mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
+ mkshort_handle_imp* hdl = (mkshort_handle_imp*) h;
hdl->whitespaceok = l;
}
void
setshort_repeating_whitespace_ok(short_handle h, int l)
{
- mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
+ mkshort_handle_imp* hdl = (mkshort_handle_imp*) h;
hdl->repeating_whitespaceok = l;
}
* becuase it was filtered by charsets or null or whatever.
*/
void
-setshort_defname(short_handle h, const char *s)
+setshort_defname(short_handle h, const char* s)
{
- mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
+ mkshort_handle_imp* hdl = (mkshort_handle_imp*) h;
if (s == NULL) {
fatal("setshort_defname called without a valid name.");
}
* resets to default.
*/
void
-setshort_badchars(short_handle h, const char *s)
+setshort_badchars(short_handle h, const char* s)
{
- mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
+ mkshort_handle_imp* hdl = (mkshort_handle_imp*) h;
if ((hdl->badchars != NULL)) {
xfree(hdl->badchars);
* in generated names.
*/
void
-setshort_goodchars(short_handle h, const char *s)
+setshort_goodchars(short_handle h, const char* s)
{
- mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
+ mkshort_handle_imp* hdl = (mkshort_handle_imp*) h;
if (hdl->goodchars != NULL) {
xfree(hdl->goodchars);
void
setshort_mustupper(short_handle h, int i)
{
- mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
+ mkshort_handle_imp* hdl = (mkshort_handle_imp*) h;
hdl->mustupper = i;
}
void
setshort_mustuniq(short_handle h, int i)
{
- mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
+ mkshort_handle_imp* hdl = (mkshort_handle_imp*) h;
hdl->must_uniq = i;
}
void
setshort_is_utf8(short_handle h, const int is_utf8)
{
- mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
+ mkshort_handle_imp* hdl = (mkshort_handle_imp*) h;
hdl->is_utf8 = is_utf8;
}
-char *
+char*
#ifdef DEBUG_MEM
-MKSHORT(short_handle h, const char *istring, DEBUG_PARAMS)
+MKSHORT(short_handle h, const char* istring, DEBUG_PARAMS)
#else
-mkshort(short_handle h, const char *istring)
+mkshort(short_handle h, const char* istring)
#endif
{
- char *ostring;
- char *nstring;
- char *tstring;
- char *cp;
- char *np;
+ char* ostring;
+ char* nstring;
+ char* tstring;
+ char* cp;
+ char* np;
int i, l, nlen, replaced;
- mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
+ mkshort_handle_imp* hdl = (mkshort_handle_imp*) h;
if (hdl->is_utf8) {
ostring = cet_utf8_strdup(istring); /* clean UTF-8 string */
if (hdl->is_utf8) {
/* ToDo: Keep trailing numeric data as described above! */
if (cet_utf8_strlen(ostring) > hdl->target_len) {
- char *tmp = cet_utf8_strndup(ostring, hdl->target_len);
+ char* tmp = cet_utf8_strndup(ostring, hdl->target_len);
xfree(ostring);
ostring = tmp;
}
} else if ((/*i = */strlen(ostring)) > hdl->target_len) {
- char *dp = &ostring[hdl->target_len] - strlen(np);
+ char* dp = &ostring[hdl->target_len] - strlen(np);
if (dp < ostring) {
dp = ostring;
}
* As above, but arg list is a waypoint so we can centralize
* the code that considers the alternate sources.
*/
-char *
-mkshort_from_wpt(short_handle h, const waypoint *wpt)
+char*
+mkshort_from_wpt(short_handle h, const waypoint* wpt)
{
/* This probably came from a Groundspeak Pocket Query
* so use the 'cache name' instead of the description field
#if 0
-char *foo[] = {
+char* foo[] = {
"VwthPst# 3700.706N 08627.588W 0000000m View the Past #2 ",
"PilotRoc 3655.270N 08717.173W 0000000m Pilot Rock by CacheAdvance ",
"MrCycsNg 3652.407N 08728.890W 0000000m Mr. Cayces Neighborhood by Ca",
main()
{
- char **foop = foo;
+ char** foop = foo;
int r;
printf("%s\n", mkshort("The Troll"));
// #define MMO_DBG
-static char *opt_locked, *opt_visible, *opt_version;
+static char* opt_locked, *opt_visible, *opt_version;
static
arglist_t mmo_args[] = {
typedef struct mmo_data_s {
int objid; /* internal object id */
- char *name;
- const char *category; /* currently not handled */
+ char* name;
+ const char* category; /* currently not handled */
gpsdata_type type; /* type of "data" */
time_t ctime;
time_t mtime;
int left; /* number of un-readed route points */
- void *data; /* can be a waypoint, a route or a track */
+ void* data; /* can be a waypoint, a route or a track */
int refct;
- struct mmo_data_s **members;
+ struct mmo_data_s** members;
unsigned char visible:1;
unsigned char locked:1;
unsigned char loaded:1;
} mmo_data_t;
-static gbfile *fin, *fout;
+static gbfile* fin, *fout;
static int mmo_version;
static int mmo_obj_ct;
static int mmo_object_id;
static gbuint16 pos_object_id;
static gbuint16 txt_object_id;
static gpsdata_type mmo_datatype;
-static route_head *mmo_rte;
+static route_head* mmo_rte;
-static avltree_t *category_names, *objects, *mmobjects, *category_ids;
-static avltree_t *icons;
+static avltree_t* category_names, *objects, *mmobjects, *category_ids;
+static avltree_t* icons;
typedef struct mmo_icon_mapping_s {
const int value;
- const char *icon;
+ const char* icon;
} mmo_icon_mapping_t;
/* standard icons; no bitmaps in file */
#ifdef MMO_DBG
static void
-dbgprintf(const char *sobj, const char *fmt, ...)
+dbgprintf(const char* sobj, const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
# define DBG(args) do {} while (0) ;
#endif
-static char *
+static char*
mmo_readstr(void)
{
- char *res;
+ char* res;
int len;
len = (unsigned)gbfgetc(fin);
fatal(MYNAME ": Invalid string length (%d)!\n", len);
}
}
- res = xmalloc(len + 1);
+ res = (char*) xmalloc(len + 1);
res[len] = '\0';
if (len) {
gbfread(res, len, 1, fin);
static int
-mmo_fillbuf2(void *buf, const gbsize_t bufsz, const gbsize_t count, const int need_all)
+mmo_fillbuf2(void* buf, const gbsize_t bufsz, const gbsize_t count, const int need_all)
{
gbsize_t res;
#define mmo_fillbuf(a,b,c) mmo_fillbuf2((a),sizeof((a)),(b),(c))
static void
-mmo_printbuf(const char *buf, int count, const char *comment)
+mmo_printbuf(const char* buf, int count, const char* comment)
{
#ifdef MMO_DBG
int i;
/******************************************************************************/
-static mmo_data_t *
-mmo_register_object(const int objid, const void *ptr, const gpsdata_type type)
+static mmo_data_t*
+mmo_register_object(const int objid, const void* ptr, const gpsdata_type type)
{
char key[16];
- mmo_data_t *data;
+ mmo_data_t* data;
- data = xcalloc(1, sizeof(*data));
- data->data = (void *)ptr;
+ data = (mmo_data_t*) xcalloc(1, sizeof(*data));
+ data->data = (void*)ptr;
data->visible = 1;
data->locked = 0;
data->type = type;
static int
-mmo_get_objid(const void *ptr)
+mmo_get_objid(const void* ptr)
{
- const char *key;
- mmo_data_t *data;
+ const char* key;
+ mmo_data_t* data;
- if ((key = avltree_first(objects, (void *)&data))) do {
+ if ((key = avltree_first(objects, (const void**)&data))) do {
if (data->data == ptr) {
return atoi(key);
}
- } while ((key = avltree_next(objects, key, (void *)&data)));
+ } while ((key = avltree_next(objects, key, (const void**)&data)));
return 0;
}
-static mmo_data_t *
+static mmo_data_t*
mmo_get_object(const gbuint16 objid)
{
char key[16];
- mmo_data_t *data;
+ mmo_data_t* data;
snprintf(key, sizeof(key), "%d", objid | 0x8000);
- if (! avltree_find(objects, key, (void *)&data)) {
+ if (! avltree_find(objects, key, (const void**)&data)) {
#ifdef MMO_DBG
gbfseek(fin, -2, SEEK_CUR);
int ni, n;
return data;
}
-static waypoint *
-mmo_get_waypt(mmo_data_t *data)
+static waypoint*
+mmo_get_waypt(mmo_data_t* data)
{
data->refct++;
if (data->refct == 1) {
- return (waypoint *)data->data;
+ return (waypoint*)data->data;
} else {
- return waypt_dupe((waypoint *)data->data);
+ return waypt_dupe((waypoint*)data->data);
}
}
static void
-mmo_release_avltree(avltree_t *tree, const int is_object)
+mmo_release_avltree(avltree_t* tree, const int is_object)
{
- const char *key;
- char *name;
+ const char* key;
+ char* name;
- if ((key = avltree_first(tree, (void *)&name))) {
+ if ((key = avltree_first(tree, (const void**)&name))) {
do {
if (name == NULL) {
continue;
}
if (is_object) {
- mmo_data_t *data = (mmo_data_t *)name;
+ mmo_data_t* data = (mmo_data_t*)name;
if (data->name) {
xfree(data->name);
}
if ((data->type == wptdata) && (data->refct == 0)) {
- waypt_free((waypoint *)data->data);
+ waypt_free((waypoint*)data->data);
}
}
xfree(name);
- } while ((key = avltree_next(tree, key, (void *)&name)));
+ } while ((key = avltree_next(tree, key, (const void**)&name)));
}
avltree_done(tree);
}
static void
-mmo_register_icon(const int id, const char *name)
+mmo_register_icon(const int id, const char* name)
{
char key[16];
}
-static mmo_data_t *mmo_read_object(void);
+static mmo_data_t* mmo_read_object(void);
static void
-mmo_end_of_route(mmo_data_t *data)
+mmo_end_of_route(mmo_data_t* data)
{
#ifdef MMO_DBG
- const char *sobj = "CObjRoute";
+ const char* sobj = "CObjRoute";
#endif
- route_head *rte = data->data;
+ route_head* rte = (route_head*) data->data;
char buf[7];
if (mmo_version >= 0x12) {
static void
-mmo_read_category(mmo_data_t *data)
+mmo_read_category(mmo_data_t* data)
{
int marker = gbfgetuint16(fin);
if (marker & 0x8000) {
- mmo_data_t *tmp;
+ mmo_data_t* tmp;
DBG(("mmo_read_category", "reading category object\n"));
gbfseek(fin, -2, SEEK_CUR);
static void
-mmo_read_CObjIcons(mmo_data_t *data)
+mmo_read_CObjIcons(mmo_data_t* data)
{
#ifdef MMO_DBG
- const char *sobj = "CObjIcons";
+ const char* sobj = "CObjIcons";
#endif
int icon_id;
gbuint16 u16;
DBG((sobj, "unknown value = 0x%04X\n", u16));
while ((icon_id = gbfgetuint32(fin))) {
- char *name;
+ char* name;
(void) gbfgetuint32(fin);
(void) gbfgetuint32(fin);
name = mmo_readstr();
static void
-mmo_read_CObjWaypoint(mmo_data_t *data)
+mmo_read_CObjWaypoint(mmo_data_t* data)
{
#ifdef MMO_DBG
- const char *sobj = "CObjWaypoint";
+ const char* sobj = "CObjWaypoint";
#endif
- waypoint *wpt;
+ waypoint* wpt;
time_t time;
int rtelinks;
- mmo_data_t **rtelink = NULL;
- char *str;
+ mmo_data_t** rtelink = NULL;
+ char* str;
char buf[16];
int i, ux;
rtelinks = gbfgetuint16(fin);
if (rtelinks > 0) {
- rtelink = xcalloc(sizeof(*rtelink), rtelinks);
+ rtelink = (mmo_data_t**) xcalloc(sizeof(*rtelink), rtelinks);
DBG((sobj, "rtelinks = %d\n", rtelinks));
for (i = 0; i < rtelinks; i++) {
- mmo_data_t *tmp;
+ mmo_data_t* tmp;
DBG((sobj, "read rtelink number %d\n", i + 1));
rtelink[i] = tmp = mmo_read_object();
str = mmo_readstr(); /* descr + url */
if (strncmp(str, "_FILE_ ", 7) == 0) {
- char *cx, *cend;
+ char* cx, *cend;
cx = lrtrim(str + 7);
cend = strchr(cx, '\n');
i = le_read32(&buf[8]); /* icon */
if (i != -1) {
char key[16];
- char *name;
+ char* name;
snprintf(key, sizeof(key), "%d", i);
- if (avltree_find(icons, key, (void *)&name)) {
+ if (avltree_find(icons, key, (const void**)&name)) {
wpt->icon_descr = xstrdup(name);
wpt->wpt_flags.icon_descr_is_dynamic = 1;
DBG((sobj, "icon = \"%s\"\n", wpt->icon_descr));
static void
-mmo_read_CObjRoute(mmo_data_t *data)
+mmo_read_CObjRoute(mmo_data_t* data)
{
#ifdef MMO_DBG
- const char *sobj = "CObjRoute";
+ const char* sobj = "CObjRoute";
#endif
int rtept;
- route_head *rte;
+ route_head* rte;
char buf[16];
int ux;
}
while (data->left > 0) {
- mmo_data_t *tmp;
+ mmo_data_t* tmp;
DBG((sobj, "read next waypoint\n"));
tmp = mmo_read_object();
if (tmp && tmp->data && (tmp->type = wptdata)) {
- waypoint *wpt;
+ waypoint* wpt;
/* FIXME: At this point this waypoint maybe not fully loaded (initialized) !!!
We need a final procedure to handle this !!! */
static void
-mmo_read_CObjTrack(mmo_data_t *data)
+mmo_read_CObjTrack(mmo_data_t* data)
{
#ifdef MMO_DBG
- const char *sobj = "CObjTrack";
+ const char* sobj = "CObjTrack";
#endif
int tp, ctp;
- route_head *trk;
+ route_head* trk;
DBG((sobj, ":-----------------------------------------------------\n"));
DBG((sobj, "name = \"%s\" [ visible=%s, id=0x%04X ]\n",
DBG((sobj, "track has %d point(s)\n", tp));
for (ctp = 0; ctp < tp; ctp++) {
- waypoint *wpt;
+ waypoint* wpt;
char unk;
wpt = waypt_new();
static void
-mmo_read_CObjText(mmo_data_t *data)
+mmo_read_CObjText(mmo_data_t* data)
{
#ifdef MMO_DBG
- const char *sobj = "CObjText";
+ const char* sobj = "CObjText";
#endif
char buf[28];
double lat, lon;
- char *text, *font;
+ char* text, *font;
DBG((sobj, ":-----------------------------------------------------\n"));
DBG((sobj, "name = \"%s\" [ visible=%s, id=0x%04X ]\n",
static void
-mmo_read_CObjCurrentPosition(mmo_data_t *data)
+mmo_read_CObjCurrentPosition(mmo_data_t* data)
{
#ifdef MMO_DBG
- const char *sobj = "CObjCurrentPosition";
+ const char* sobj = "CObjCurrentPosition";
#endif
char buf[24];
double lat, lon;
mmo_fillbuf(buf, 24, 1);
if (mmo_version >= 0x14) {
- char *name;
+ char* name;
name = mmo_readstr();
DBG((sobj, "name = \"%s\"\n", name));
}
-static mmo_data_t *
+static mmo_data_t*
mmo_read_object(void)
{
int objid;
- mmo_data_t *data = NULL;
+ mmo_data_t* data = NULL;
// There are three cases:
// a new object of a type that has not occurred previously in this file;
objid = gbfgetuint16(fin);
if (objid == 0xFFFF) {
gbuint16 version;
- char *sobj;
+ char* sobj;
int len;
DBG(("mmo_read_object", "Registering new object type\n"));
len = gbfgetint16(fin);
- sobj = xmalloc(len + 1);
+ sobj = (char*) xmalloc(len + 1);
sobj[len] = '\0';
gbfread(sobj, len, 1, fin);
DBG(("mmo_read_object", "%s\n", sobj));
DBG(("mmo_read_object", "objid = 0x%04X\n", objid));
if (objid & 0x8000) {
- data = mmo_register_object(mmo_object_id++, NULL, 0);
+ data = mmo_register_object(mmo_object_id++, NULL, (gpsdata_type)0);
data->name = mmo_readstr();
if (objid != cat_object_id) {
}
static void
-mmo_finalize_rtept_cb(const waypoint *wptref)
+mmo_finalize_rtept_cb(const waypoint* wptref)
{
- waypoint *wpt = (waypoint *)wptref;
+ waypoint* wpt = (waypoint*)wptref;
if ((wpt->shortname[0] == 1) && (wpt->latitude == 0) && (wpt->longitude == 0)) {
- mmo_data_t *data;
- waypoint *wpt2;
+ mmo_data_t* data;
+ waypoint* wpt2;
sscanf(wpt->shortname + 1, "%p", &data);
- wpt2 = (waypoint *)data->data;
+ wpt2 = (waypoint*)data->data;
wpt->latitude = wpt2->latitude;
wpt->longitude = wpt2->longitude;
*******************************************************************************/
static void
-mmo_rd_init(const char *fname)
+mmo_rd_init(const char* fname)
{
int i;
mmo_read(void)
{
#ifdef MMO_DBG
- const char *sobj = "main";
+ const char* sobj = "main";
#endif
- gbfile *fx;
+ gbfile* fx;
int i;
/* copy file to memory stream (needed for seek-ops and piped commands) */
/**************************************************************************/
static void
-mmo_register_category_names(const char *name)
+mmo_register_category_names(const char* name)
{
char key[16];
static void
-mmo_writestr(const char *str)
+mmo_writestr(const char* str)
{
int len = strlen(str);
static void
-mmo_enum_waypt_cb(const waypoint *wpt)
+mmo_enum_waypt_cb(const waypoint* wpt)
{
mmo_obj_ct++;
}
static void
-mmo_enum_route_cb(const route_head *rte)
+mmo_enum_route_cb(const route_head* rte)
{
if (rte->rte_waypt_ct > 0) {
mmo_obj_ct++;
static int
-mmo_write_obj_mark(const char *sobj, const char *name)
+mmo_write_obj_mark(const char* sobj, const char* name)
{
- char *key;
+ char* key;
gbuint16 nr;
char buf[16];
int res;
- if (avltree_find(mmobjects, sobj, (void *)&key)) {
+ if (avltree_find(mmobjects, sobj, (const void**)&key)) {
nr = (unsigned)atoi(key);
gbfputuint16(nr, fout);
} else {
static void
-mmo_write_category(const char *sobj, const char *name)
+mmo_write_category(const char* sobj, const char* name)
{
- char *key;
+ char* key;
gbuint16 nr;
- if (avltree_find(category_names, name, (void *)&key)) {
+ if (avltree_find(category_names, name, (const void**)&key)) {
nr = (unsigned)atoi(key);
gbfputuint16(nr & 0x7FFF, fout);
} else {
static int
-mmo_write_obj_head(const char *sobj, const char *name, const time_t ctime,
+mmo_write_obj_head(const char* sobj, const char* name, const time_t ctime,
const gbuint32 obj_type)
{
int res;
static void
-mmo_write_wpt_cb(const waypoint *wpt)
+mmo_write_wpt_cb(const waypoint* wpt)
{
- char *str, *cx;
+ char* str, *cx;
int objid;
time_t time;
int icon = 0;
- mmo_data_t *data;
+ mmo_data_t* data;
time = wpt->creation_time;
if (time < 0) {
cx = wpt->description;
}
if (cx != NULL) {
- char *kml = NULL;
+ char* kml = NULL;
if (strcmp(wpt->session->name, "kml") == 0) {
utf_string tmp;
static void
-mmo_write_rte_head_cb(const route_head *rte)
+mmo_write_rte_head_cb(const route_head* rte)
{
int objid;
- queue *elem, *tmp;
+ queue* elem, *tmp;
time_t time = 0x7FFFFFFF;
if (rte->rte_waypt_ct <= 0) {
return;
}
- mmo_rte = (route_head *)rte;
+ mmo_rte = (route_head*)rte;
QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) {
- waypoint *wpt = (waypoint *)elem;
+ waypoint* wpt = (waypoint*)elem;
if ((wpt->creation_time > 0) && (wpt->creation_time < time)) {
time = wpt->creation_time;
static void
-mmo_write_rte_tail_cb(const route_head *rte)
+mmo_write_rte_tail_cb(const route_head* rte)
{
- queue *elem, *tmp;
+ queue* elem, *tmp;
if (rte->rte_waypt_ct <= 0) {
return;
}
QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) {
- waypoint *wpt = (waypoint *)elem;
+ waypoint* wpt = (waypoint*)elem;
int objid = mmo_get_objid(wpt);
gbfputuint16(objid & 0x7FFF, fout);
}
static void
-mmo_write_trk_head_cb(const route_head *trk)
+mmo_write_trk_head_cb(const route_head* trk)
{
int objid;
static void
-mmo_write_trk_tail_cb(const route_head *trk)
+mmo_write_trk_tail_cb(const route_head* trk)
{
if (trk->rte_waypt_ct <= 0) {
return;
/**************************************************************************/
static void
-mmo_wr_init(const char *fname)
+mmo_wr_init(const char* fname)
{
fout = gbfopen_le(fname, "wb", MYNAME);
#undef OLE_DEBUG
-static gbfile *fin;
+static gbfile* fin;
static arglist_t msroute_args[] = {
ARG_TERMINATOR
#define max(a,b) ((a) > (b)) ? (a) : (b)
#endif
-static gbint32 *ole_fat1 = NULL;
-static gbint32 *ole_fat2 = NULL;
+static gbint32* ole_fat1 = NULL;
+static gbint32* ole_fat2 = NULL;
static int ole_fat1_ct;
static int ole_fat2_ct;
static int ole_size1;
static int ole_size2;
static int ole_size1_min = 4096;
-static ole_prop_t *ole_dir = NULL;
+static ole_prop_t* ole_dir = NULL;
static int ole_dir_ct;
-static ole_prop_t *ole_root = NULL;
-static char **ole_root_sec = NULL;
+static ole_prop_t* ole_root = NULL;
+static char** ole_root_sec = NULL;
static int ole_root_sec_ct;
/* local helpers */
static void
-le_read32_buff(int *buff, const int count)
+le_read32_buff(int* buff, const int count)
{
int i;
for (i = 0; i < count; i++) {
/* simple OLE file reader */
static void
-ole_read_sector(const int sector, void *target, const char full)
+ole_read_sector(const int sector, void* target, const char full)
{
int res;
MYNAME ": Read error (%d, sector %d) on file \"%s\"!", res, sector, fin->name);
}
-static ole_prop_t *
-ole_find_property(const char *property)
+static ole_prop_t*
+ole_find_property(const char* property)
{
int i;
for (i = 0; i < ole_dir_ct; i++) {
int len, test;
- char *str;
- ole_prop_t *item;
+ char* str;
+ ole_prop_t* item;
item = &ole_dir[i];
if ((item->ole_typ != 1) && (item->ole_typ != 2) && (item->ole_typ != 5)) {
}
len = min(OLE_MAX_NAME_LENGTH, item->name_sz / 2);
- str = cet_str_uni_to_utf8((short *)&item->name, len);
+ str = cet_str_uni_to_utf8((short*)&item->name, len);
test = case_ignore_strcmp(str, property);
xfree(str);
return 0;
}
-static char *
-ole_read_stream(const ole_prop_t *property)
+static char*
+ole_read_stream(const ole_prop_t* property)
{
- const char *action = "ole_read_stream";
+ const char* action = "ole_read_stream";
int len, sector, big, blocksize, offs, left;
int i;
- int *fat;
- char *buff;
+ int* fat;
+ char* buff;
len = property->data_sz;
sector = property->first_sector;
i = ((len + blocksize - 1) / blocksize) * blocksize;
- buff = xmalloc(i); /* blocksize aligned */
+ buff = (char*) xmalloc(i); /* blocksize aligned */
if (big != 0) {
while (left > 0) {
offs = 0;
while (blocks-- > 0) {
- char *temp;
+ char* temp;
int block_offs;
is_fatal((chain < 0), MYNAME ": Broken stream (%s)!", action);
}
-static char *
-ole_read_property_stream(const char *property_name, int *data_sz)
+static char*
+ole_read_property_stream(const char* property_name, int* data_sz)
{
- ole_prop_t *property;
- char *result;
+ ole_prop_t* property;
+ char* result;
if ((property = ole_find_property(property_name)) == NULL) {
return NULL;
int i;
for (i = 0; i < ole_dir_ct; i++) {
- char *temp;
+ char* temp;
char name[OLE_MAX_NAME_LENGTH + 1];
- ole_prop_t *p = &ole_dir[i];
+ ole_prop_t* p = &ole_dir[i];
if ((p->ole_typ != 1) && (p->ole_typ != 2) && (p->ole_typ != 5)) {
continue;
memset(&head, 0, sizeof(head));
gbfread(&head, sizeof(head), 1, fin);
- is_fatal((strncmp(head.magic, (char *) ole_magic, sizeof(ole_magic)) != 0), MYNAME ": No MS document.");
+ is_fatal((strncmp(head.magic, (char*) ole_magic, sizeof(ole_magic)) != 0), MYNAME ": No MS document.");
head.rev = le_read16(&head.rev);
head.ver = le_read16(&head.ver);
#else
is_fatal((ole_size1 != 512), MYNAME ": Unsupported sector size %d", ole_size1);
#endif
- ole_fat1 = xmalloc(head.fat1_blocks * sector_sz);
+ ole_fat1 = (gbint32*) xmalloc(head.fat1_blocks * sector_sz);
ole_fat1_ct = (head.fat1_blocks * sector_sz) / sizeof(gbint32);
#ifdef OLE_DEBUG
count = 0;
do {
if (ole_fat2 == NULL) {
- ole_fat2 = (int *)xmalloc((count + 1) * sector_sz);
+ ole_fat2 = (int*)xmalloc((count + 1) * sector_sz);
} else {
- ole_fat2 = (int *)xrealloc(ole_fat2, (count + 1) * sector_sz);
+ ole_fat2 = (int*)xrealloc(ole_fat2, (count + 1) * sector_sz);
}
- ole_read_sector(sector, (char *)ole_fat2 + (count * sector_sz), 1);
+ ole_read_sector(sector, (char*)ole_fat2 + (count * sector_sz), 1);
sector = ole_fat1[sector];
count++;
count = 0;
while (sector >= 0) {
if (ole_dir == NULL) {
- ole_dir = (void *)xmalloc((count + 1) * sector_sz);
+ ole_dir = (ole_prop_t*)xmalloc((count + 1) * sector_sz);
} else {
- ole_dir = (void *)xrealloc(ole_dir, (count + 1) * sector_sz);
+ ole_dir = (ole_prop_t*)xrealloc(ole_dir, (count + 1) * sector_sz);
}
- ole_read_sector(sector, (char *)ole_dir + (count * sector_sz), 1);
+ ole_read_sector(sector, (char*)ole_dir + (count * sector_sz), 1);
sector = ole_fat1[sector];
count++;
/* fix endianess of property catalog */
for (i = 0; i < ole_dir_ct; i++) {
- ole_prop_t *item = &ole_dir[i];
+ ole_prop_t* item = &ole_dir[i];
item->first_sector = le_read32(&item->first_sector);
item->data_sz = le_read32(&item->data_sz);
/* read fat2 data sectors given by "Root Entry" */
ole_root_sec_ct = (ole_root->data_sz + (sector_sz - 1)) / sector_sz;
- ole_root_sec = xcalloc(ole_root_sec_ct + 1, sizeof(char *));
+ ole_root_sec = (char**) xcalloc(ole_root_sec_ct + 1, sizeof(char*));
i = 0;
sector = ole_root->first_sector;
while (sector >= 0) {
- char *temp;
+ char* temp;
- temp = ole_root_sec[i++] = xmalloc(sector_sz);
+ temp = ole_root_sec[i++] = (char*) xmalloc(sector_sz);
ole_read_sector(sector, temp, 1);
sector = ole_fat1[sector];
if (ole_root_sec != NULL) {
int i;
for (i = 0; i < ole_root_sec_ct; i++) {
- char *c;
+ char* c;
if ((c = ole_root_sec[i])) {
xfree(c);
}
msroute_read_journey(void)
{
int bufsz = 0;
- char *buff;
+ char* buff;
buff = ole_read_property_stream(MSROUTE_OBJ_NAME, &bufsz);
if ((buff != NULL) && (bufsz > 0)) {
- msroute_head_t *head = (msroute_head_t *)buff;
- unsigned char *cin, *cend;
+ msroute_head_t* head = (msroute_head_t*)buff;
+ unsigned char* cin, *cend;
int count = 0;
- route_head *route;
- waypoint *wpt;
+ route_head* route;
+ waypoint* wpt;
char version;
is_fatal((strncmp(head->masm, "MASM", 4) != 0), MYNAME ": Invalid or unknown data!");
version = buff[0x14];
is_fatal((version < 1) || (version > 7), MYNAME ": Unsupported version %d!", version);
- cin = (unsigned char *)buff + 71; // (at least?) sizeof(msroute_head_t);
- cend = (unsigned char *)buff + bufsz;
+ cin = (unsigned char*)buff + 71; // (at least?) sizeof(msroute_head_t);
+ cend = (unsigned char*)buff + bufsz;
route = route_head_alloc();
route_add_head(route);
cin += 3; /* 0xfffeff */
len = *cin++;
- wpt->shortname = cet_str_uni_to_utf8((const short *)cin, len);
+ wpt->shortname = cet_str_uni_to_utf8((const short*)cin, len);
cin += (len * 2); /* seek over wide string */
cin += (5 * sizeof(gbint32)); /* five unknown DWORDs */
/* registered callbacks */
-static void msroute_rd_init(const char *fname)
+static void msroute_rd_init(const char* fname)
{
fin = gbfopen(fname, "rb", MYNAME);
0xbb, 0xbb, 0xbb, 0xbb
}; /* end marker */
-static const char *MTK_ACK[] = { /* Flags returned from PMTK001 ack packet */
+static const char* MTK_ACK[] = { /* Flags returned from PMTK001 ack packet */
"Invalid packet", "Unsupported packet type",
"Valid packet but action failed", "Valid packet, action success"
};
struct log_type {
int id;
int size;
- const char *name;
+ const char* name;
} log_type[32] = {
{ 0, 4, "UTC" },
{ 1, 2, "VALID" },
#define HOLUX245_MASK (1 << 27)
-static void *fd; /* serial fd */
-static FILE *fl; /* bin.file fd */
-static char *port; /* serial port name */
-static char *OPT_erase; /* erase ? command option */
-static char *OPT_erase_only; /* erase_only ? command option */
-static char *OPT_log_enable; /* enable ? command option */
-static char *csv_file; /* csv ? command option */
+static void* fd; /* serial fd */
+static FILE* fl; /* bin.file fd */
+static char* port; /* serial port name */
+static char* OPT_erase; /* erase ? command option */
+static char* OPT_erase_only; /* erase_only ? command option */
+static char* OPT_log_enable; /* enable ? command option */
+static char* csv_file; /* csv ? command option */
static enum MTK_DEVICE_TYPE mtk_device = MTK_LOGGER;
struct mtk_loginfo mtk_info;
const char CMD_LOG_STATUS[] = "$PMTK182,2,7*3C\r\n";
static int mtk_log_len(unsigned int bitmask);
-static void mtk_rd_init(const char *fname);
-static void file_init(const char *fname);
+static void mtk_rd_init(const char* fname);
+static void file_init(const char* fname);
static void file_deinit(void) ;
static void holux245_init(void);
static void file_read(void);
-static int mtk_parse_info(const unsigned char *data, int dataLen);
+static int mtk_parse_info(const unsigned char* data, int dataLen);
// Arguments for log fetch 'mtk' command..
ARG_TERMINATOR
};
-static void dbg(int l, const char *msg, ...)
+static void dbg(int l, const char* msg, ...)
{
va_list ap;
va_start(ap, msg);
}
va_end(ap);
}
-static int do_send_cmd(const char *cmd, int cmdLen)
+static int do_send_cmd(const char* cmd, int cmdLen)
{
int rc;
}
-static int do_cmd(const char *cmd, const char *expect, char **rslt, time_t timeout_sec)
+static int do_cmd(const char* cmd, const char* expect, char** rslt, time_t timeout_sec)
{
char line[256];
int len, done, loops, cmd_erase;
}
// printf("Data segment: #%s#\n", &line[expect_len+1]);
if (rslt) {
- *rslt = xmalloc(len-3-expect_len+1);
+ *rslt = (char*) xmalloc(len-3-expect_len+1);
strcpy(*rslt, &line[expect_len+1]);
}
}
} else if (strncmp(line, "$PMTK", 5) == 0) {
/* A quick parser for ACK packets */
if (!cmd_erase && strncmp(line, "$PMTK001,", 9) == 0 && line[9] != '\0') {
- char *pType, *pRslt;
+ char* pType, *pRslt;
int pAck;
pType = &line[9];
pRslt = strchr(&line[9], ',') + 1;
/*******************************************************************************
* %%% global callbacks called by gpsbabel main process %%% *
*******************************************************************************/
-static void mtk_rd_init_m241(const char *fname)
+static void mtk_rd_init_m241(const char* fname)
{
mtk_device = HOLUX_M241;
mtk_rd_init(fname);
}
-static void mtk_rd_init(const char *fname)
+static void mtk_rd_init(const char* fname)
{
int rc;
- char *model;
+ char* model;
port = xstrdup(fname);
static int mtk_erase(void)
{
int log_status, log_mask, err;
- char *lstatus = NULL;
+ char* lstatus = NULL;
log_status = 0;
// check log status - is logging disabled ?
static void mtk_read(void)
{
char cmd[256];
- char *line = NULL;
+ char* line = NULL;
unsigned char crc, *data = NULL;
int cmdLen, j, bsize, i, len, ff_len, null_len, rc, init_scan, retry_cnt, log_enabled;
unsigned int line_size, data_size, data_addr, addr, addr_max;
unsigned long dsize, dpos = 0;
- FILE *dout;
- char *fusage = NULL;
+ FILE* dout;
+ char* fusage = NULL;
if (*OPT_erase_only != '0') {
line_size = 2*bsize + 32; // logdata as nmea/hex.
data_size = bsize + 32;
- if ((line = xmalloc(line_size)) == NULL) {
+ if ((line = (char*) xmalloc(line_size)) == NULL) {
fatal(MYNAME ": Can't allocate %u bytes for NMEA buffer\n", line_size);
}
- if ((data = xmalloc(data_size)) == NULL) {
+ if ((data = (unsigned char*) xmalloc(data_size)) == NULL) {
fatal(MYNAME ": Can't allocate %u bytes for data buffer\n", data_size);
}
memset(line, '\0', line_size);
}
-static route_head *trk_head = NULL;
-static int add_trackpoint(int idx, unsigned long bmask, struct data_item *itm)
+static route_head* trk_head = NULL;
+static int add_trackpoint(int idx, unsigned long bmask, struct data_item* itm)
{
char wp_name[20];
- waypoint *trk = waypt_new();
+ waypoint* trk = waypt_new();
- if (global_opts.masked_objective & TRKDATAMASK && (trk_head == NULL || (mtk_info.track_event & MTK_EVT_START))) {
+ if (global_opts.masked_objective& TRKDATAMASK && (trk_head == NULL || (mtk_info.track_event & MTK_EVT_START))) {
char spds[50];
trk_head = route_head_alloc();
xasprintf(&trk_head->rte_name, "track-%d", 1+track_count());
)
) {
/* Button press -- create waypoint, start count at 1 */
- waypoint *w = waypt_dupe(trk);
+ waypoint* w = waypt_dupe(trk);
sprintf(wp_name, "WP%06d", waypt_count()+1);
w->shortname = xstrdup(wp_name);
/********************** MTK Logger -- CSV output *************************/
-static gbfile *cd;
-static void mtk_csv_init(char *csv_fname, unsigned long bitmask)
+static gbfile* cd;
+static void mtk_csv_init(char* csv_fname, unsigned long bitmask)
{
int i;
- FILE *cf;
+ FILE* cf;
dbg(1, "Opening csv output file %s...\n", csv_fname);
}
/* Output a single data line in MTK application compatible format - i.e ignore any locale settings... */
-static int csv_line(gbfile *csvFile, int idx, unsigned long bmask, struct data_item *itm)
+static int csv_line(gbfile* csvFile, int idx, unsigned long bmask, struct data_item* itm)
{
- struct tm *ts_tm;
+ struct tm* ts_tm;
char ts_str[30];
- const char *fix_str = "";
+ const char* fix_str = "";
ts_tm = gmtime(&(itm->timestamp));
strftime(ts_str, sizeof(ts_str)-1, "%Y/%m/%d,%H:%M:%S", ts_tm);
/********************* MTK Logger -- Parse functions *********************/
-int mtk_parse(unsigned char *data, int dataLen, unsigned int bmask)
+int mtk_parse(unsigned char* data, int dataLen, unsigned int bmask)
{
static int count = 0;
int i, k, sat_id, hspd;
Description: Parse an info block
Globals: mtk_info - bitmask/period/speed/... may be affected if updated.
*/
-static int mtk_parse_info(const unsigned char *data, int dataLen)
+static int mtk_parse_info(const unsigned char* data, int dataLen)
{
unsigned short cmd;
unsigned int bm;
/********************** File-in interface ********************************/
-static void file_init_m241(const char *fname)
+static void file_init_m241(const char* fname)
{
mtk_device = HOLUX_M241;
file_init(fname);
}
-static void file_init(const char *fname)
+static void file_init(const char* fname)
{
dbg(4, "Opening file %s...\n", fname);
if (fl = fopen(fname, "rb"), NULL == fl) {
log_type[SPEED].size = 3; // height size..
}
-static int is_holux_string(const unsigned char *data, int dataLen)
+static int is_holux_string(const unsigned char* data, int dataLen)
{
if (mtk_device != MTK_LOGGER &&
dataLen >= 5 &&
static XML_Parser psr;
#endif
-static waypoint *wpt_tmp;
+static waypoint* wpt_tmp;
-static gbfile *fin, *fout;
+static gbfile* fin, *fout;
-static char *noretired = NULL;
+static char* noretired = NULL;
static
arglist_t nav_args[] = {
#if ! HAVE_LIBEXPAT
static void
-nav_rd_init(const char *fname)
+nav_rd_init(const char* fname)
{
fatal(MYNAME ": This build excluded GPX support because expat was not installed.\n");
}
static struct
nc_type_mapping {
geocache_type type;
- const char *name;
+ const char* name;
} nc_type_map[] = {
{ gt_unknown, "unknown" },
{ gt_traditional, "normal" },
static struct
nc_container_mapping {
geocache_container type;
- const char *name;
+ const char* name;
} nc_container_map[] = {
{ gc_other, "Unknown" },
{ gc_micro, "Micro" },
static
geocache_type
-nc_mktype(const char *t)
+nc_mktype(const char* t)
{
int i;
int sz = sizeof(nc_type_map) / sizeof(nc_type_map[0]);
static
geocache_container
-nc_mkcont(const char *t)
+nc_mkcont(const char* t)
{
int i;
int sz = sizeof(nc_container_map) / sizeof(nc_container_map[0]);
}
static void
-nav_start(void *data, const XML_Char *xml_el, const XML_Char **xml_attr)
+nav_start(void* data, const XML_Char* xml_el, const XML_Char** xml_attr)
{
- const char *el;
- const char **attr;
+ const char* el;
+ const char** attr;
el = xml_convert_to_char_string(xml_el);
attr = xml_convert_attrs_to_char_string(xml_attr);
if (0 == strcmp(el, "CacheDetails")) {
- const char **ap;
- geocache_data *gc_data;
+ const char** ap;
+ geocache_data* gc_data;
wpt_tmp = waypt_new();
gc_data = waypt_alloc_gc_data(wpt_tmp);
}
static void
-nav_end(void *data, const XML_Char *el)
+nav_end(void* data, const XML_Char* el)
{
}
static void
-nav_rd_init(const char *fname)
+nav_rd_init(const char* fname)
{
fin = gbfopen(fname, "r", MYNAME);
}
static void
-nav_wr_init(const char *fname)
+nav_wr_init(const char* fname)
{
fatal(MYNAME ": Does not support writing Navicache files.\n");
fout = gbfopen(fname, "w", MYNAME);
/* Global variables */
-static gbfile *file_in, *file_out;
+static gbfile* file_in, *file_out;
static gbuint16 nof_wp;
-static route_head *rte_head;
+static route_head* rte_head;
static ng_file_header_t ng_file_header;
static ng_wp_no_comment_t WPNC;
static ng_next_wp_t ng_next_wp;
/* wp - process only waypoints */
/* rte - process as route */
/* wprte - Process waypoints and route */
-static char *process = NULL;
-static char *reorder = NULL;
+static char* process = NULL;
+static char* reorder = NULL;
static int process_rte = 1;
static int reorder_wp = 0;
/*===================Utilities ==========================================*/
static void
-ng_convert_datum(waypoint *wpt)
+ng_convert_datum(waypoint* wpt)
{
double lat, lon, east, north, alt;
/*=================== File read/write utilities ==========================================*/
static void
-ng_fwrite_wp_data(char *s, char *d, ng_wp_data_t *wp_data, gbfile *f)
+ng_fwrite_wp_data(char* s, char* d, ng_wp_data_t* wp_data, gbfile* f)
{
int i;
char z[50];
}
static void
-ng_fwrite_next_wp(ng_next_wp_t *nwp, gbfile *f)
+ng_fwrite_next_wp(ng_next_wp_t* nwp, gbfile* f)
{
gbfwrite(nwp->pad1, 2, 1, f);
gbfputint16(nwp->next_wp, f);
}
static void
-ng_fread_wp_data(char *d, ng_wp_no_comment_t *wpnc, gbfile *f)
+ng_fread_wp_data(char* d, ng_wp_no_comment_t* wpnc, gbfile* f)
{
int i;
}
static void
-ng_fread_next_wp(ng_next_wp_t *nwp, gbfile *f)
+ng_fread_next_wp(ng_next_wp_t* nwp, gbfile* f)
{
gbfread(&nwp->pad1, 2, 1, f);
nwp->next_wp = gbfgetint16(f);
static void
-ng_waypt_rd(const waypoint * wpt)
+ng_waypt_rd(const waypoint* wpt)
{
- char * s = NULL;
+ char* s = NULL;
char z[50];
double lat, lon;
static void
-wr_init(const char *fname)
+wr_init(const char* fname)
{
file_out = gbfopen_le(fname, "wb", MYNAME);
ng_fill_header_default();
/*=========================== Read data functions ==================================*/
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
file_in = gbfopen_le(fname, "rb", MYNAME);
{
int n;
unsigned i;
- waypoint *wpt_tmp;
+ waypoint* wpt_tmp;
if (process_rte) {
rte_head = route_head_alloc();
#define MYNAME "NAVILINK"
-static char *nuketrk = NULL;
-static char *nukerte = NULL;
-static char *nukewpt = NULL;
-static char *nukedlg = NULL;
-static char *poweroff = NULL;
-static char *datalog = NULL;
-
-static void *serial_handle = NULL;
-static gbfile *file_handle = NULL;
-
-static unsigned char *track_data;
-static unsigned char *track_data_ptr;
-static unsigned char *track_data_end;
+static char* nuketrk = NULL;
+static char* nukerte = NULL;
+static char* nukewpt = NULL;
+static char* nukedlg = NULL;
+static char* poweroff = NULL;
+static char* datalog = NULL;
+
+static void* serial_handle = NULL;
+static gbfile* file_handle = NULL;
+
+static unsigned char* track_data;
+static unsigned char* track_data_ptr;
+static unsigned char* track_data_end;
static unsigned track_serial;
-static waypoint **route_waypts;
-static unsigned *route_ids;
+static waypoint** route_waypts;
+static unsigned* route_ids;
static unsigned route_id_ptr;
static enum {
#define PID_CLEAR_DATALOG 0x1b
static
-const char *const icon_table[] = {
+const char* const icon_table[] = {
"Star",
"Flag",
"House",
ARG_TERMINATOR
};
-static void (*write_waypoint)(const waypoint *) = NULL;
-static void (*write_track_start)(const route_head *track) = NULL;
-static void (*write_track_point)(const waypoint *waypt) = NULL;
-static void (*write_track_end)(const route_head *track) = NULL;
-static void (*write_route_start)(const route_head *track) = NULL;
-static void (*write_route_point)(const waypoint *waypt) = NULL;
-static void (*write_route_end)(const route_head *track) = NULL;
+static void (*write_waypoint)(const waypoint*) = NULL;
+static void (*write_track_start)(const route_head* track) = NULL;
+static void (*write_track_point)(const waypoint* waypt) = NULL;
+static void (*write_track_end)(const route_head* track) = NULL;
+static void (*write_route_start)(const route_head* track) = NULL;
+static void (*write_route_point)(const waypoint* waypt) = NULL;
+static void (*write_route_end)(const route_head* track) = NULL;
static int
-find_icon_from_descr(const char *descr)
+find_icon_from_descr(const char* descr)
{
int i;
- for (i = 0; descr && i < sizeof(icon_table) / sizeof(const char *); i++) {
+ for (i = 0; descr && i < sizeof(icon_table) / sizeof(const char*); i++) {
if (strcmp(descr, icon_table[i]) == 0) {
return i;
}
}
static void
-free_waypoints(waypoint **waypts)
+free_waypoints(waypoint** waypts)
{
- waypoint **wayptp;
+ waypoint** wayptp;
for (wayptp = waypts; wayptp < waypts + MAX_WAYPOINTS; wayptp++) {
if (*wayptp) {
}
static unsigned
-compare_waypoints(const waypoint *waypt1, const waypoint *waypt2)
+compare_waypoints(const waypoint* waypt1, const waypoint* waypt2)
{
return waypt1->latitude == waypt2->latitude &&
waypt1->longitude == waypt2->longitude &&
}
unsigned
-navilink_checksum_packet(const unsigned char *packet, unsigned length)
+navilink_checksum_packet(const unsigned char* packet, unsigned length)
{
unsigned checksum = 0;
#ifdef NAVILINK_DEBUG
static void
-dump_packet(char *prefix, unsigned char *packet, unsigned length)
+dump_packet(char* prefix, unsigned char* packet, unsigned length)
{
unsigned i;
#endif
static void
-write_packet(unsigned type, const void *payload, unsigned length)
+write_packet(unsigned type, const void* payload, unsigned length)
{
- unsigned char *packet = xmalloc(length + 9);
+ unsigned char* packet = (unsigned char*) xmalloc(length + 9);
packet[0] = 0xa0;
packet[1] = 0xa2;
* Returns TRUE if the packet was successfully read into payload.
*/
static int
-read_packet(unsigned type, void *payload,
+read_packet(unsigned type, void* payload,
unsigned minlength, unsigned maxlength,
int handle_nak)
{
unsigned size;
- unsigned char *data;
+ unsigned char* data;
unsigned checksum;
if (read_word() != 0xa2a0) {
fatal(MYNAME ": Protocol error: Packet too short\n");
}
- data = xmalloc(size);
+ data = (unsigned char*) xmalloc(size);
if (gbser_read_wait(serial_handle, data, size, SERIAL_TIMEOUT) != size) {
fatal(MYNAME ": Read error reading %d byte payload\n", size);
}
static time_t
-decode_datetime(const unsigned char *buffer)
+decode_datetime(const unsigned char* buffer)
{
struct tm tm;
}
static void
-encode_datetime(time_t datetime, unsigned char *buffer)
+encode_datetime(time_t datetime, unsigned char* buffer)
{
- struct tm *tm;
+ struct tm* tm;
if ((tm = gmtime(&datetime)) != NULL) {
buffer[0] = tm->tm_year - 100;
}
static void
-decode_position(const unsigned char *buffer, waypoint *waypt)
+decode_position(const unsigned char* buffer, waypoint* waypt)
{
waypt->latitude = le_read32(buffer + 0) / 10000000.0;
waypt->longitude = le_read32(buffer + 4) / 10000000.0;
}
static void
-encode_position(const waypoint *waypt, unsigned char *buffer)
+encode_position(const waypoint* waypt, unsigned char* buffer)
{
le_write32(buffer + 0, (int)(waypt->latitude * 10000000));
le_write32(buffer + 4, (int)(waypt->longitude * 10000000));
}
static unsigned
-decode_waypoint_id(const unsigned char *buffer)
+decode_waypoint_id(const unsigned char* buffer)
{
unsigned id = le_read16(buffer + 2);
return id;
}
-static waypoint *
-decode_waypoint(const unsigned char *buffer)
+static waypoint*
+decode_waypoint(const unsigned char* buffer)
{
- waypoint *waypt = waypt_new();
+ waypoint* waypt = waypt_new();
decode_position(buffer + 12, waypt);
- waypt->shortname = xstrdup((char *)buffer + 4);
+ waypt->shortname = xstrdup((char*)buffer + 4);
waypt->icon_descr = icon_table[buffer[28]];
waypt->creation_time = decode_datetime(buffer + 22);
}
static void
-encode_waypoint(const waypoint *waypt, unsigned char *buffer)
+encode_waypoint(const waypoint* waypt, unsigned char* buffer)
{
buffer[0] = 0x00;
buffer[1] = 0x40;
le_write16(buffer + 2, 0);
- strncpy((char *)buffer + 4, waypt->shortname, 6);
+ strncpy((char*)buffer + 4, waypt->shortname, 6);
buffer[10] = 0;
buffer[11] = 0;
encode_position(waypt, buffer + 12);
buffer[31] = 0x7e;
}
-static waypoint *
-decode_trackpoint(const unsigned char *buffer)
+static waypoint*
+decode_trackpoint(const unsigned char* buffer)
{
- waypoint *waypt = waypt_new();
+ waypoint* waypt = waypt_new();
decode_position(buffer + 12, waypt);
waypt->creation_time = decode_datetime(buffer + 22);
}
static void
-encode_trackpoint(const waypoint *waypt, unsigned serial, unsigned char *buffer)
+encode_trackpoint(const waypoint* waypt, unsigned serial, unsigned char* buffer)
{
double x;
double y;
buffer[31] = 0x7e;
}
-static waypoint **
+static waypoint**
serial_read_waypoints(void)
{
- waypoint **waypts = NULL;
+ waypoint** waypts = NULL;
unsigned char information[32];
unsigned short total;
unsigned short start;
if (global_opts.masked_objective & RTEDATAMASK) {
- waypts = xcalloc(MAX_WAYPOINTS, sizeof(waypoint *));
+ waypts = (waypoint**) xcalloc(MAX_WAYPOINTS, sizeof(waypoint*));
}
write_packet(PID_QRY_INFORMATION, NULL, 0);
for (start = 0; start < total; start += 32) {
unsigned short count = total - start;
unsigned char payload[7];
- unsigned char *waypoints;
- unsigned char *w;
+ unsigned char* waypoints;
+ unsigned char* w;
if (count > 32) {
count = 32;
write_packet(PID_QRY_WAYPOINTS, payload, sizeof(payload));
- waypoints = xmalloc(count * 32);
+ waypoints = (unsigned char*) xmalloc(count * 32);
read_packet(PID_DATA, waypoints, count * 32, count * 32, FALSE);
}
static unsigned int
-serial_write_waypoint_packet(const waypoint *waypt)
+serial_write_waypoint_packet(const waypoint* waypt)
{
unsigned char data[32];
unsigned char id[2];
}
static void
-serial_write_waypoint(const waypoint *waypt)
+serial_write_waypoint(const waypoint* waypt)
{
serial_write_waypoint_packet(waypt);
}
unsigned char information[32];
unsigned int address;
unsigned short total;
- route_head *track;
+ route_head* track;
write_packet(PID_QRY_INFORMATION, NULL, 0);
read_packet(PID_DATA, information,
while (total > 0) {
unsigned short count = total < MAX_READ_TRACKPOINTS ? total : MAX_READ_TRACKPOINTS;
unsigned char payload[7];
- unsigned char *trackpoints;
- unsigned char *t;
+ unsigned char* trackpoints;
+ unsigned char* t;
le_write32(payload + 0, address);
le_write16(payload + 4, count * 32);
write_packet(PID_READ_TRACKPOINTS, payload, sizeof(payload));
- trackpoints = xmalloc(count * 32);
+ trackpoints = (unsigned char*) xmalloc(count * 32);
read_packet(PID_DATA, trackpoints, count * 32, count * 32, FALSE);
write_packet(PID_ACK, NULL, 0);
}
static void
-serial_write_track_start(const route_head *track)
+serial_write_track_start(const route_head* track)
{
- track_data = xmalloc(MAX_WRITE_TRACKPOINTS * 32);
+ track_data = (unsigned char*) xmalloc(MAX_WRITE_TRACKPOINTS * 32);
track_data_ptr = track_data;
track_data_end = track_data + MAX_WRITE_TRACKPOINTS * 32;
}
static void
-serial_write_track_point(const waypoint *waypt)
+serial_write_track_point(const waypoint* waypt)
{
if (track_data_ptr >= track_data_end) {
serial_write_track();
}
static void
-serial_write_track_end(const route_head *track)
+serial_write_track_end(const route_head* track)
{
if (track_data_ptr > track_data) {
serial_write_track();
}
static void
-serial_read_routes(waypoint **waypts)
+serial_read_routes(waypoint** waypts)
{
unsigned char information[32];
unsigned char routec;
for (r = 0; r < routec; r++) {
unsigned char payload[7];
unsigned char routedata[320];
- route_head *route;
+ route_head* route;
int sr;
le_write32(payload + 0, r);
route = route_head_alloc();
route->rte_num = routedata[2];
- route->rte_name = xstrdup((char *)routedata + 4);
+ route->rte_name = xstrdup((char*)routedata + 4);
route_add_head(route);
for (sr = 0; sr < MAX_SUBROUTES; sr++) {
}
static void
-serial_write_route_start(const route_head *route)
+serial_write_route_start(const route_head* route)
{
- route_ids = xmalloc(route->rte_waypt_ct * sizeof(unsigned));
+ route_ids = (unsigned int*) xmalloc(route->rte_waypt_ct * sizeof(unsigned));
route_id_ptr = 0;
}
static void
-serial_write_route_point(const waypoint *waypt)
+serial_write_route_point(const waypoint* waypt)
{
unsigned w;
}
static void
-serial_write_route_end(const route_head *route)
+serial_write_route_end(const route_head* route)
{
- unsigned char *data;
+ unsigned char* data;
unsigned src;
unsigned sr;
unsigned char id[1];
}
src = (route_id_ptr + MAX_SUBROUTE_LENGTH) / MAX_SUBROUTE_LENGTH;
- data = xmalloc(32 + src * 32);
+ data = (unsigned char*) xmalloc(32 + src * 32);
le_write16(data + 0, 0x2000);
data[2] = 0;
data[3] = 0x20;
- strncpy((char *)data + 4, route->rte_name, 6);
+ strncpy((char*)data + 4, route->rte_name, 6);
data[18] = 0;
data[19] = 0;
le_write32(data + 20, 0);
data[31] = 0x77;
for (sr = 0; sr < src; sr++) {
- unsigned char *srdata = data + 32 + 32 * sr;
+ unsigned char* srdata = data + 32 + 32 * sr;
unsigned pt_offset = MAX_SUBROUTE_LENGTH * sr;
unsigned pt;
}
static int
-decode_sbp_usec(const unsigned char *buffer)
+decode_sbp_usec(const unsigned char* buffer)
{
int msec = le_read16(buffer);
return (msec % 1000) * 1000;
}
static time_t
-decode_sbp_datetime_packed(const unsigned char *buffer)
+decode_sbp_datetime_packed(const unsigned char* buffer)
{
/*
* Packed_Date_Time_UTC:
}
static void
-decode_sbp_position(const unsigned char *buffer, waypoint *waypt)
+decode_sbp_position(const unsigned char* buffer, waypoint* waypt)
{
waypt->latitude = le_read32(buffer + 0) / 10000000.0;
waypt->longitude = le_read32(buffer + 4) / 10000000.0;
waypt->altitude = le_read32(buffer + 8) / 100.0;
}
-waypoint *
-navilink_decode_logpoint(const unsigned char *buffer)
+waypoint*
+navilink_decode_logpoint(const unsigned char* buffer)
{
- waypoint *waypt = NULL;
+ waypoint* waypt = NULL;
waypt = waypt_new();
waypt->hdop = ((unsigned char)buffer[0]) * 0.2f;
* around), then seg2_addr and seg2_len will be zero.
*/
static void
-read_datalog_info(unsigned int *seg1_addr, unsigned int *seg1_len,
- unsigned int *seg2_addr, unsigned int *seg2_len)
+read_datalog_info(unsigned int* seg1_addr, unsigned int* seg1_len,
+ unsigned int* seg2_addr, unsigned int* seg2_len)
{
unsigned char info[16];
unsigned int flash_start_addr;
}
static void
-read_datalog_records(route_head *track,
+read_datalog_records(route_head* track,
unsigned int start_addr, unsigned int len)
{
unsigned char logpoints[MAX_READ_LOGPOINTS * SBP_RECORD_LEN];
unsigned int logpoints_len;
unsigned char payload[7];
- unsigned char *p;
+ unsigned char* p;
/* The protocol only supports reading 256 logpoints at once, so
* read small chunks until none left. */
static void
serial_read_datalog(void)
{
- route_head *track;
+ route_head* track;
unsigned int seg1_addr;
unsigned int seg1_len;
unsigned int seg2_addr;
file_read(void)
{
unsigned char data[32];
- route_head *track = NULL;
+ route_head* track = NULL;
while (gbfread(data, sizeof(data), 1, file_handle) == 1) {
switch (le_read16(data)) {
}
static void
-file_write_waypoint(const waypoint *waypt)
+file_write_waypoint(const waypoint* waypt)
{
unsigned char data[32];
}
static void
-file_write_track_start(const route_head *track)
+file_write_track_start(const route_head* track)
{
track_serial = 1;
}
static void
-file_write_track_point(const waypoint *waypt)
+file_write_track_point(const waypoint* waypt)
{
unsigned char data[32];
}
static void
-file_write_track_end(const route_head *track)
+file_write_track_end(const route_head* track)
{
}
static void
-file_write_route_start(const route_head *track)
+file_write_route_start(const route_head* track)
{
fatal(MYNAME ": Can't write routes to a file\n");
}
static void
-file_write_route_point(const waypoint *waypt)
+file_write_route_point(const waypoint* waypt)
{
}
static void
-file_write_route_end(const route_head *track)
+file_write_route_end(const route_head* track)
{
}
}
static void
-navilink_common_init(const char *name)
+navilink_common_init(const char* name)
{
if (gbser_is_serial(name)) {
if ((serial_handle = gbser_init(name)) == NULL) {
write_route_point = serial_write_route_point;
write_route_end = serial_write_route_end;
} else {
- char *mode = operation == READING ? "r" : "w+";
+ const char* mode = operation == READING ? "r" : "w+";
file_handle = gbfopen(name, mode, MYNAME);
write_waypoint = file_write_waypoint;
}
static void
-navilink_rd_init(const char *name)
+navilink_rd_init(const char* name)
{
operation = READING;
navilink_common_init(name);
}
static void
-navilink_wr_init(const char *name)
+navilink_wr_init(const char* name)
{
operation = WRITING;
navilink_common_init(name);
}
} else {
if (serial_handle) {
- waypoint **waypts = NULL;
+ waypoint** waypts = NULL;
if (global_opts.masked_objective & (WPTDATAMASK|RTEDATAMASK)) {
waypts = serial_read_waypoints();
#define SBP_RECORD_LEN 32
/* defined in navilink.c */
-waypoint *navilink_decode_logpoint(const unsigned char *buffer);
-unsigned navilink_checksum_packet(const unsigned char *packet, unsigned length);
+waypoint* navilink_decode_logpoint(const unsigned char* buffer);
+unsigned navilink_checksum_packet(const unsigned char* packet, unsigned length);
/* defined in sbn.c */
-int locosys_decode_file_id(char *header, size_t len);
+int locosys_decode_file_id(char* header, size_t len);
#ifdef THIS_IS_ONLY_FOR_REFERENCE
#define MYNAME "navitel"
-static gbfile *fin, *fout;
+static gbfile* fin, *fout;
static char new_track;
static int trkpts;
*******************************************************************************/
static void
-navitel_rd_init(const char *fname)
+navitel_rd_init(const char* fname)
{
fin = gbfopen(fname, "rb", MYNAME);
}
navitel_read_track(void)
{
int points, i;
- route_head *trk = NULL;
+ route_head* trk = NULL;
points = gbfgetint32(fin);
(void) gbfgetint32(fin); /* unknown */
for (i = 0; i < points; i++) {
int lat, lon;
- waypoint *wpt;
+ waypoint* wpt;
lon = gbfgetint32(fin);
lat = gbfgetint32(fin);
}
static void
-navitel_wr_init(const char *fname)
+navitel_wr_init(const char* fname)
{
fout = gbfopen(fname, "wb", MYNAME);
}
}
static void
-navitel_enum_trkpts(const waypoint *wpt)
+navitel_enum_trkpts(const waypoint* wpt)
{
trkpts++;
}
static void
-navitel_disp_trk_head(const route_head *trk)
+navitel_disp_trk_head(const route_head* trk)
{
new_track = 1;
}
static void
-navitel_disp_trkpts(const waypoint *wpt)
+navitel_disp_trkpts(const waypoint* wpt)
{
int lat, lon;
ff_type_file,
{
ff_cap_none /* waypoints */,
- ff_cap_read | ff_cap_write /* tracks */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */,
ff_cap_none /* routes */
},
navitel_rd_init,
#include "csv_util.h"
#include <ctype.h>
-static gbfile *file_in;
-static char *nseicon = NULL;
-static char *nsneicon = NULL;
-static char *seicon = NULL;
-static char *sneicon = NULL;
-static char *snmac = NULL;
+static gbfile* file_in;
+static char* nseicon = NULL;
+static char* nsneicon = NULL;
+static char* seicon = NULL;
+static char* sneicon = NULL;
+static char* snmac = NULL;
static int macstumbler;
static void fix_netstumbler_dupes(void);
};
static void
-rd_init(const char *fname)
+rd_init(const char* fname)
{
file_in = gbfopen(fname, "rb", MYNAME);
macstumbler = 0;
static void
data_read(void)
{
- char *ibuf;
+ char* ibuf;
char ssid[2 + 32 + 2 + 1]; /* "( " + SSID + " )" + null */
char mac[2 + 17 + 2 + 1]; /* "( " + MAC + " )" + null */
char desc[sizeof ssid - 1 + 15 + 1]; /* room for channel/speed */
double lat = 0, lon = 0;
- waypoint *wpt_tmp;
+ waypoint* wpt_tmp;
int line_no = 0;
int stealth_num = 0, whitespace_num = 0;
long flags = 0;
memset(&tm, 0, sizeof(tm));
while ((ibuf = gbfgetstr(file_in))) {
- char *field;
+ char* field;
int field_num, len, i, stealth = 0;
if ((line++ == 0) && file_in->unicode) {
typedef struct {
unsigned long crc;
- waypoint *wpt;
+ waypoint* wpt;
} htable_t;
static
int
-compare(const void *a, const void *b)
+compare(const void* a, const void* b)
{
- unsigned long crc_a = ((const htable_t *)a)->crc;
- unsigned long crc_b = ((const htable_t *)b)->crc;
+ unsigned long crc_a = ((const htable_t*)a)->crc;
+ unsigned long crc_b = ((const htable_t*)b)->crc;
/* we can't just return crc_a - crc_b because the return type is
* signed.
* to make the testo script happy.
* */
- waypoint *wpt_a = ((const htable_t *)a)->wpt;
- waypoint *wpt_b = ((const htable_t *)b)->wpt;
+ waypoint* wpt_a = ((const htable_t*)a)->wpt;
+ waypoint* wpt_b = ((const htable_t*)b)->wpt;
return strcmp(wpt_a->description, wpt_b->description);
}
fix_netstumbler_dupes(void)
{
int i, ct = waypt_count(), serial = 0;
- htable_t *htable, *bh;
- queue *elem, *tmp;
+ htable_t* htable, *bh;
+ queue* elem, *tmp;
extern queue waypt_head;
- const char *snptr;
- char *tmp_sn;
+ const char* snptr;
+ char* tmp_sn;
unsigned long last_crc;
char ssid[32 + 5 + 1];
- htable = (htable_t *) xmalloc(ct * sizeof *htable);
+ htable = (htable_t*) xmalloc(ct * sizeof *htable);
bh = htable;
i = 0;
QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
- bh->wpt = (waypoint *) elem;
+ bh->wpt = (waypoint*) elem;
snptr = bh->wpt->shortname;
tmp_sn = strlower(xstrdup(snptr));
bh->crc = get_crc32(tmp_sn, strlen(snptr));
rm_file
} read_mode;
-static gbfile *file_in, *file_out;
-static route_head *trk_head;
+static gbfile* file_in, *file_out;
+static route_head* trk_head;
static short_handle mkshort_handle;
static preferred_posn_type posn_type;
static struct tm tm;
-static waypoint *curr_waypt;
-static waypoint *last_waypt;
-static void * gbser_handle;
-static const char *posn_fname;
+static waypoint* curr_waypt;
+static waypoint* last_waypt;
+static void* gbser_handle;
+static const char* posn_fname;
static queue pcmpt_head;
static int without_date; /* number of created trackpoints without a valid date */
#define MYNAME "nmea"
-static char *opt_gprmc;
-static char *opt_gpgga;
-static char *opt_gpvtg;
-static char *opt_gpgsa;
-static char *snlenopt;
-static char *optdate;
-static char *getposnarg;
-static char *opt_sleep;
-static char *opt_baud;
-static char *opt_append;
-static char *opt_gisteq;
+static char* opt_gprmc;
+static char* opt_gpgga;
+static char* opt_gpvtg;
+static char* opt_gpgsa;
+static char* snlenopt;
+static char* optdate;
+static char* getposnarg;
+static char* opt_sleep;
+static char* opt_baud;
+static char* opt_append;
+static char* opt_gisteq;
static long sleepus;
static int getposn;
static int datum;
static int had_checksum;
-static waypoint * nmea_rd_posn(posn_status *);
-static void nmea_rd_posn_init(const char *fname);
+static waypoint* nmea_rd_posn(posn_status*);
+static void nmea_rd_posn_init(const char* fname);
arglist_t nmea_args[] = {
{"snlen", &snlenopt, "Max length of waypoint name to write", "6", ARGTYPE_INT, "1", "64" },
* Slightly different than the Magellan checksum fn.
*/
int
-nmea_cksum(const char *const buf)
+nmea_cksum(const char* const buf)
{
int x = 0 ;
- const char *p;
+ const char* p;
for (p = buf; *p; p++) {
x ^= *p;
}
static void
-nmea_add_wpt(waypoint *wpt, route_head *trk)
+nmea_add_wpt(waypoint* wpt, route_head* trk)
{
if (datum != DATUM_WGS84) {
double lat, lon, alt;
}
static void
-nmea_release_wpt(waypoint *wpt)
+nmea_release_wpt(waypoint* wpt)
{
if (wpt && ((wpt->Q.next == NULL) || (wpt->Q.next == &wpt->Q))) {
/* This waypoint isn't queued.
}
static void
-nmea_rd_init(const char *fname)
+nmea_rd_init(const char* fname)
{
curr_waypt = NULL;
last_waypt = NULL;
* it as one waypoint.
*/
if (getposn) {
- waypoint *wpt;
+ waypoint* wpt;
posn_status st;
nmea_rd_posn_init(fname);
wpt = nmea_rd_posn(&st);
}
static void
-nmea_wr_init(const char *portname)
+nmea_wr_init(const char* portname)
{
CHECK_BOOL(opt_gprmc);
CHECK_BOOL(opt_gpgga);
}
static void
-nmea_set_waypoint_time(waypoint *wpt, struct tm *time, int microseconds)
+nmea_set_waypoint_time(waypoint* wpt, struct tm* time, int microseconds)
{
if (time->tm_year == 0) {
wpt->creation_time = ((((time_t)time->tm_hour * 60) + time->tm_min) * 60) + time->tm_sec;
}
static void
-gpgll_parse(char *ibuf)
+gpgll_parse(char* ibuf)
{
double latdeg, lngdeg, microseconds;
char lngdir, latdir;
double hmsd;
int hms;
char valid = 0;
- waypoint *waypt;
+ waypoint* waypt;
if (trk_head == NULL) {
trk_head = route_head_alloc();
}
static void
-gpgga_parse(char *ibuf)
+gpgga_parse(char* ibuf)
{
double latdeg, lngdeg;
char lngdir, latdir;
int nsats = 0;
double hdop;
char altunits;
- waypoint *waypt;
+ waypoint* waypt;
double microseconds;
if (trk_head == NULL) {
}
static void
-gprmc_parse(char *ibuf)
+gprmc_parse(char* ibuf)
{
double latdeg, lngdeg;
char lngdir, latdir;
char fix;
unsigned int dmy;
double speed,course;
- waypoint *waypt;
+ waypoint* waypt;
double microseconds;
- char *dmybuf;
+ char* dmybuf;
int i;
if (trk_head == NULL) {
}
static void
-gpwpl_parse(char *ibuf)
+gpwpl_parse(char* ibuf)
{
- waypoint *waypt;
+ waypoint* waypt;
double latdeg, lngdeg;
char latdir, lngdir;
char sname[99];
}
static void
-gpzda_parse(char *ibuf)
+gpzda_parse(char* ibuf)
{
double hms;
int dd, mm, yy, lclhrs, lclmins;
}
static void
-gpgsa_parse(char *ibuf)
+gpgsa_parse(char* ibuf)
{
char fixauto;
char fix;
}
static void
-gpvtg_parse(char *ibuf)
+gpvtg_parse(char* ibuf)
{
float course;
char ct;
}
void
-pcmpt_parse(char *ibuf)
+pcmpt_parse(char* ibuf)
{
int i, j1, j2, j3, j4, j5, j6;
int lat, lon;
dmy = hms = 0;
sscanf(ibuf,"$PCMPT,%d,%d,%d,%c,%f,%d,%[^,],%d,%f,%d,%f,%c,%d,%c,%d",
- &j1, &j2, &j3, &altflag, &alt, &j4, (char *) &coords,
+ &j1, &j2, &j3, &altflag, &alt, &j4, (char*) &coords,
&j5, &f1, &j6, &f2, &u1, &dmy, &u2, &hms);
if (altflag == 'D' && curr_waypt && alt > 0) {
nmea_set_waypoint_time(curr_waypt, &tm, 0);
ENQUEUE_HEAD(&pcmpt_head, &curr_waypt->Q);
} else {
- queue *elem, *tmp;
- route_head *trk_head;
+ queue* elem, *tmp;
+ route_head* trk_head;
if (QUEUE_EMPTY(&pcmpt_head)) {
return;
trk_head = route_head_alloc();
track_add_head(trk_head);
QUEUE_FOR_EACH(&pcmpt_head, elem, tmp) {
- waypoint *wpt = (waypoint *) dequeue(elem);
+ waypoint* wpt = (waypoint*) dequeue(elem);
nmea_add_wpt(wpt, trk_head);
}
}
}
static void
-nmea_fix_timestamps(route_head *track)
+nmea_fix_timestamps(route_head* track)
{
if ((trk_head == NULL) || (without_date == 0)) {
return;
}
if (tm.tm_year == 0) {
- queue *elem, *temp;
- waypoint *prev = NULL;
+ queue* elem, *temp;
+ waypoint* prev = NULL;
time_t delta_tm;
if (optdate == NULL) {
delta_tm = mkgmtime(&opt_tm);
QUEUE_FOR_EACH(&track->waypoint_list, elem, temp) {
- waypoint *wpt = (waypoint *)elem;
+ waypoint* wpt = (waypoint*)elem;
wpt->creation_time += delta_tm;
if ((prev != NULL) && (prev->creation_time > wpt->creation_time)) { /* go over midnight ? */
}
} else {
time_t prev;
- queue *elem;
+ queue* elem;
tm.tm_hour = 23; /* last date found */
tm.tm_min = 59;
/* go backward through the track and complete timestamps */
for (elem = QUEUE_LAST(&track->waypoint_list); elem != &track->waypoint_list; elem=elem->prev) {
- waypoint *wpt = (waypoint *)elem;
+ waypoint* wpt = (waypoint*)elem;
if (wpt->wpt_flags.fmt_use != 0) {
time_t dt;
}
void
-nmea_parse_one_line(char *ibuf)
+nmea_parse_one_line(char* ibuf)
{
- char *ck;
+ char* ck;
int ckval, ckcmp;
- char *tbuf = lrtrim(ibuf);
+ char* tbuf = lrtrim(ibuf);
/*
* GISTEQ PhotoTracker (stupidly) puts a bogus field in front
static void
nmea_read(void)
{
- char *ibuf;
- char *ck;
+ char* ibuf;
+ char* ck;
double lt = -1;
int line = -1;
if (optdate) {
memset(&opt_tm, 0, sizeof(opt_tm));
- ck = (char *)strptime(optdate, "%Y%m%d", &opt_tm);
+ ck = (char*)strptime(optdate, "%Y%m%d", &opt_tm);
if ((ck == NULL) || (*ck != '\0') || (strlen(optdate) != 8)) {
fatal(MYNAME ": Invalid date \"%s\"!\n", optdate);
} else if (opt_tm.tm_year < 70) {
curr_waypt = NULL;
while ((ibuf = gbfgetstr(file_in))) {
- char *sdatum, *cx;
+ char* sdatum, *cx;
line++;
/* Check the GPS datum */
cx = strchr(&ibuf[12], '/');
if (cx != NULL) {
- char *edatum;
+ char* edatum;
sdatum = cx + 1;
edatum = strchr(sdatum, '/');
if (edatum) {
}
void
-nmea_rd_posn_init(const char *fname)
+nmea_rd_posn_init(const char* fname)
{
if ((gbser_handle = gbser_init(fname)) != NULL) {
read_mode = rm_serial;
}
static void
-safe_print(int cnt, const char *b)
+safe_print(int cnt, const char* b)
{
int i;
for (i = 0; i < cnt; i++) {
{
/* Try to place the common BR's first to speed searching */
static int br[] = {38400, 9600, 57600, 115200, 19200, 4800, -1};
- static int *brp = &br[0];
+ static int* brp = &br[0];
char ibuf[1024];
for (brp = br; *brp > 0; brp++) {
return 0;
}
-static waypoint *
-nmea_rd_posn(posn_status *posn_status)
+static waypoint*
+nmea_rd_posn(posn_status* posn_status)
{
char ibuf[1024];
static double lt = -1;
nmea_parse_one_line(ibuf);
if (lt != last_read_time) {
if (last_read_time) {
- waypoint *w = curr_waypt;
+ waypoint* w = curr_waypt;
lt = last_read_time;
curr_waypt = NULL;
}
static void
-nmea_wayptpr(const waypoint *wpt)
+nmea_wayptpr(const waypoint* wpt)
{
char obuf[200];
double lat,lon;
- char *s;
+ char* s;
int cksum;
lat = degrees2ddmm(wpt->latitude);
}
void
-nmea_track_init(const route_head *rte)
+nmea_track_init(const route_head* rte)
{
last_time = -1;
}
void
-nmea_trackpt_pr(const waypoint *wpt)
+nmea_trackpt_pr(const waypoint* wpt)
{
char obuf[200];
char fix='0';
double lat,lon;
int cksum;
- struct tm *tm;
+ struct tm* tm;
time_t hms;
time_t ymd;
}
static void
-nmea_wr_posn_init(const char *fname)
+nmea_wr_posn_init(const char* fname)
{
nmea_wr_init(fname);
}
static void
-nmea_wr_posn(waypoint *wpt)
+nmea_wr_posn(waypoint* wpt)
{
nmea_trackpt_pr(wpt);
}
*/
static void
-sirf_write(unsigned char *buf)
+sirf_write(unsigned char* buf)
{
int i, chksum = 0;
int len = buf[2] << 8 | buf[3];
#include <stdlib.h>
#include <stdarg.h>
-static gbfile *fin, *fout;
+static gbfile* fin, *fout;
static int curr_rte_num, target_rte_num;
#define MYNAME "navigon"
-static char *index_opt;
+static char* index_opt;
static
arglist_t nmn4_args[] = {
/* helpers */
-static char *
-nmn4_concat(char *arg0, ...)
+static char*
+nmn4_concat(char* arg0, ...)
{
va_list args;
- char *src, *res;
+ char* src, *res;
res = NULL;
va_start(args, arg0);
- src = (char *)arg0;
+ src = (char*)arg0;
while (src != NULL) {
- char *c = lrtrim(src);
+ char* c = lrtrim(src);
if (*c != '\0') {
if (res == NULL) {
}
}
xfree(src);
- src = va_arg(args, char *);
+ src = va_arg(args, char*);
}
va_end(args);
}
static void
-nmn4_check_line(char *line)
+nmn4_check_line(char* line)
{
- char *c = line;
+ char* c = line;
int i = 0;
while ((c = strchr(c, '|'))) {
c++;
static void
nmn4_read_data(void)
{
- char *buff;
- char *str, *c;
+ char* buff;
+ char* str, *c;
int column;
int line = 0;
- char *zip1, *zip2, *city, *street, *number;
- route_head *route;
- waypoint *wpt;
+ char* zip1, *zip2, *city, *street, *number;
+ route_head* route;
+ waypoint* wpt;
route = route_head_alloc();
route_add_head(route);
}
static void
-nmn4_route_hdr(const route_head *route)
+nmn4_route_hdr(const route_head* route)
{
curr_rte_num++;
}
static void
-nmn4_route_tlr(const route_head *rte)
+nmn4_route_tlr(const route_head* rte)
{
}
static void
-nmn4_write_waypt(const waypoint *wpt)
+nmn4_write_waypt(const waypoint* wpt)
{
char city[128], street[128], zipc[32], number[32];
/* %%% global callbacks %%% */
static void
-nmn4_rd_init(const char *fname)
+nmn4_rd_init(const char* fname)
{
fin = gbfopen(fname, "rb", MYNAME);
}
}
static void
-nmn4_wr_init(const char *fname)
+nmn4_wr_init(const char* fname)
{
fout = gbfopen(fname, "wb", MYNAME);
}
ff_vecs_t nmn4_vecs = {
ff_type_file,
- { ff_cap_none, ff_cap_none, ff_cap_read | ff_cap_write},
+ { ff_cap_none, ff_cap_none, (ff_cap)(ff_cap_read | ff_cap_write)},
nmn4_rd_init,
nmn4_wr_init,
nmn4_rd_deinit,
#if FILTERS_ENABLED
#define MYNAME "nukedata"
-static char *nukewpts, *nuketrks, *nukertes;
+static char* nukewpts, *nuketrks, *nukertes;
static
arglist_t nuke_args[] = {
#include "avltree.h"
#include "xmlgeneric.h"
-static char *opt_tag, *opt_tagnd, *created_by;
+static char* opt_tag, *opt_tagnd, *created_by;
static arglist_t osm_args[] = {
{ "tag", &opt_tag, "Write additional way tag key/value pairs", NULL, ARGTYPE_STRING, ARG_NOMINMAX },
#define MYNAME "osm"
-static avltree_t *waypoints; /* AVL tree */
+static avltree_t* waypoints; /* AVL tree */
-static avltree_t *keys = NULL;
-static avltree_t *values = NULL;
-static avltree_t *icons = NULL;
+static avltree_t* keys = NULL;
+static avltree_t* values = NULL;
+static avltree_t* icons = NULL;
-static gbfile *fout;
+static gbfile* fout;
static int node_id;
static int skip_rte;
#if HAVE_LIBEXPAT
-static route_head *rte;
-static waypoint *wpt;
+static route_head* rte;
+static waypoint* wpt;
static int wpt_loaded, rte_loaded;
static xg_callback osm_node, osm_node_tag, osm_node_end;
{ osm_way_nd, cb_start, "/osm/way/nd" },
{ osm_way_tag, cb_start, "/osm/way/tag" },
{ osm_way_end, cb_end, "/osm/way" },
- { NULL, 0, NULL }
+ { NULL, (xg_cb_type)0, NULL }
};
#endif // HAVE_LIBEXPAT
-static const char *osm_features[] = {
+static const char* osm_features[] = {
"- dummy -", /* 0 */
"aeroway", /* 1 */
"amenity", /* 2 */
typedef struct osm_icon_mapping_s {
const int key;
- const char *value;
- const char *icon;
+ const char* value;
+ const char* icon;
} osm_icon_mapping_t;
#if ! HAVE_LIBEXPAT
void
-osm_rd_init(const char *fname)
+osm_rd_init(const char* fname)
{
fatal(MYNAME ": This build excluded \" MYNAME \" support because expat was not installed.\n");
}
buff[0] = osm_icon_mappings[i].key;
strncpy(&buff[1], osm_icon_mappings[i].value, sizeof(buff) - 1);
- avltree_insert(values, buff, (const void *)&osm_icon_mappings[i]);
+ avltree_insert(values, buff, (const void*)&osm_icon_mappings[i]);
}
}
static char
-osm_feature_ikey(const char *key)
+osm_feature_ikey(const char* key)
{
int result;
- const void *p;
+ const void* p;
if (avltree_find(keys, key, &p)) {
result = gb_ptr2int(p);
}
-static char *
-osm_feature_symbol(const int ikey, const char *value)
+static char*
+osm_feature_symbol(const int ikey, const char* value)
{
- char *result;
+ char* result;
char buff[128];
- osm_icon_mapping_t *data;
+ osm_icon_mapping_t* data;
buff[0] = ikey;
strncpy(&buff[1], value, sizeof(buff) - 1);
- if (avltree_find(values, buff, (void *)&data)) {
+ if (avltree_find(values, buff, (const void**)&data)) {
result = xstrdup(data->icon);
} else {
xasprintf(&result, "%s:%s", osm_features[ikey], value);
}
-static char *
-osm_strip_html(const char *str)
+static char*
+osm_strip_html(const char* str)
{
utf_string utf;
utf.is_html = 1;
- utf.utfstring = (char *)str;
+ utf.utfstring = (char*)str;
return strip_html(&utf); // util.c
}
static void
-osm_node_end(const char *args, const char **unused)
+osm_node_end(const char* args, const char** unused)
{
if (wpt) {
if (wpt->wpt_flags.fmt_use) {
static void
-osm_node(const char *args, const char **attrv)
+osm_node(const char* args, const char** attrv)
{
- const char **avp = &attrv[0];
+ const char** avp = &attrv[0];
wpt = waypt_new();
while (*avp) {
if (strcmp(avp[0], "id") == 0) {
xasprintf(&wpt->description, "osm-id %s", avp[1]);
- if (! avltree_insert(waypoints, avp[1], (void *)wpt)) {
+ if (! avltree_insert(waypoints, avp[1], (void*)wpt)) {
warning(MYNAME ": Duplicate osm-id %s!\n", avp[1]);
} else {
wpt->wpt_flags.fmt_use = 1;
static void
-osm_node_tag(const char *args, const char **attrv)
+osm_node_tag(const char* args, const char** attrv)
{
- const char **avp = &attrv[0];
- const char *key = "", *value = "";
- char *str;
+ const char** avp = &attrv[0];
+ const char* key = "", *value = "";
+ char* str;
signed char ikey;
while (*avp) {
wpt->wpt_flags.icon_descr_is_dynamic = 1;
} else if (strcmp(key, "note") == 0) {
if (wpt->notes) {
- char *tmp;
+ char* tmp;
xasprintf(&tmp, "%s; %s", wpt->notes, str);
xfree(wpt->notes);
wpt->notes = tmp;
static void
-osm_way(const char *args, const char **attrv)
+osm_way(const char* args, const char** attrv)
{
- const char **avp = &attrv[0];
+ const char** avp = &attrv[0];
rte = route_head_alloc();
}
static void
-osm_way_nd(const char *args, const char **attrv)
+osm_way_nd(const char* args, const char** attrv)
{
- const char **avp = &attrv[0];
+ const char** avp = &attrv[0];
while (*avp) {
if (strcmp(avp[0], "ref") == 0) {
- waypoint *tmp;
- if (avltree_find(waypoints, avp[1], (void *)&tmp)) {
+ waypoint* tmp;
+ if (avltree_find(waypoints, avp[1], (const void**)&tmp)) {
tmp = waypt_dupe(tmp);
route_add_wpt(rte, tmp);
} else {
}
static void
-osm_way_tag(const char *args, const char **attrv)
+osm_way_tag(const char* args, const char** attrv)
{
- const char **avp = &attrv[0];
- const char *key = "", *value = "";
- char *str;
+ const char** avp = &attrv[0];
+ const char* key = "", *value = "";
+ char* str;
while (*avp) {
if (strcmp(avp[0], "k") == 0) {
}
static void
-osm_way_end(const char *args, const char **unused)
+osm_way_end(const char* args, const char** unused)
{
if (rte) {
route_add_head(rte);
}
static void
-osm_rd_init(const char *fname)
+osm_rd_init(const char* fname)
{
wpt = NULL;
rte = NULL;
icons = avltree_init(AVLTREE_STATIC_KEYS, MYNAME);
for (i = 0; osm_icon_mappings[i].value; i++) {
- avltree_insert(icons, osm_icon_mappings[i].icon, (const void *)&osm_icon_mappings[i]);
+ avltree_insert(icons, osm_icon_mappings[i].icon, (const void*)&osm_icon_mappings[i]);
}
}
static void
-osm_write_tag(const char *key, const char *value)
+osm_write_tag(const char* key, const char* value)
{
if (value && *value) {
- char *str = xml_entitize(value);
+ char* str = xml_entitize(value);
gbfprintf(fout, " <tag k='%s' v='%s'/>\n", key, str);
xfree(str);
}
}
static void
-osm_disp_feature(const waypoint *wpt)
+osm_disp_feature(const waypoint* wpt)
{
- osm_icon_mapping_t *map;
+ osm_icon_mapping_t* map;
- if (avltree_find(icons, wpt->icon_descr, (void *) &map)) {
+ if (avltree_find(icons, wpt->icon_descr, (const void**) &map)) {
osm_write_tag(osm_features[map->key], map->value);
}
}
static void
-osm_write_opt_tag(const char *atag)
+osm_write_opt_tag(const char* atag)
{
- char *tag, *cin, *ce;
+ char* tag, *cin, *ce;
if (!atag) {
return;
ce = cin + strlen(cin);
while (cin < ce) {
- char *sc, *dp;
+ char* sc, *dp;
if ((sc = strchr(cin, ';'))) {
*sc = '\0';
}
static void
-osm_release_ids(const waypoint *wpt)
+osm_release_ids(const waypoint* wpt)
{
if (wpt && wpt->extra_data) {
- waypoint *tmp = (waypoint *)wpt;
+ waypoint* tmp = (waypoint*)wpt;
xfree(tmp->extra_data);
tmp->extra_data = NULL;
}
}
static void
-osm_waypt_disp(const waypoint *wpt)
+osm_waypt_disp(const waypoint* wpt)
{
- char *buff;
+ char* buff;
xasprintf(&buff, "%s\01%f\01%f", (wpt->shortname) ? wpt->shortname : "",
wpt->latitude, wpt->longitude);
- if (avltree_insert(waypoints, buff, (const void *) wpt)) {
- int *id;
+ if (avltree_insert(waypoints, buff, (const void*) wpt)) {
+ int* id;
- id = xmalloc(sizeof(*id));
+ id = (int*) xmalloc(sizeof(*id));
*id = --node_id;
- ((waypoint *)(wpt))->extra_data = id;
+ ((waypoint*)(wpt))->extra_data = id;
gbfprintf(fout, " <node id='%d' visible='true' lat='%0.7f' lon='%0.7f'", *id, wpt->latitude, wpt->longitude);
if (wpt->creation_time) {
}
static void
-osm_rte_disp_head(const route_head *rte)
+osm_rte_disp_head(const route_head* rte)
{
skip_rte = (rte->rte_waypt_ct <= 0);
}
static void
-osm_rtept_disp(const waypoint *wpt_ref)
+osm_rtept_disp(const waypoint* wpt_ref)
{
- char *buff;
- waypoint *wpt;
+ char* buff;
+ waypoint* wpt;
if (skip_rte) {
return;
xasprintf(&buff, "%s\01%f\01%f", (wpt_ref->shortname) ? wpt_ref->shortname : "",
wpt_ref->latitude, wpt_ref->longitude);
- if (avltree_find(waypoints, buff, (void *) &wpt)) {
- int *id = wpt->extra_data;
+ if (avltree_find(waypoints, buff, (const void**) &wpt)) {
+ int* id = (int*) wpt->extra_data;
gbfprintf(fout, " <nd ref='%d'/>\n", *id);
}
}
static void
-osm_rte_disp_trail(const route_head *rte)
+osm_rte_disp_trail(const route_head* rte)
{
if (skip_rte) {
return;
/*-----------------------------------------------------------------------------*/
static void
-osm_wr_init(const char *fname)
+osm_wr_init(const char* fname)
{
fout = gbfopen(fname, "w", MYNAME);
ff_vecs_t osm_vecs = {
ff_type_file,
{
- ff_cap_read | ff_cap_write /* waypoints */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */,
ff_cap_write /* tracks */,
- ff_cap_read | ff_cap_write /* routes */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* routes */,
},
osm_rd_init,
osm_wr_init,
#undef MAPNAME
#define MAPNAME "Top. Karte 1:50.000 Nieders."
-static gbfile *fpout;
-static gbfile *fpin;
+static gbfile* fpout;
+static gbfile* fpin;
static int govl_cnt;
static double govl_sum_e=0.0;
static double govl_sum_n=0.0;
*/
static int govl_col=1;
-static char *govl_col_s = NULL;
+static char* govl_col_s = NULL;
static int govl_size=101;
-static char *govl_size_s = NULL;
+static char* govl_size_s = NULL;
static double govl_dir=0.0;
-static char *govl_mapname = NULL;
+static char* govl_mapname = NULL;
static int govl_zoomfc = 100;
-static char *govl_zoomfc_s = NULL;
+static char* govl_zoomfc_s = NULL;
static int govl_dimmfc = 100;
-static char *govl_dimmfc_s = NULL;
+static char* govl_dimmfc_s = NULL;
static int govl_txtcol=1;
static int govl_font=1;
static int govl_txttrans=0;
-static char *govl_txtcol_s = NULL;
-static char *govl_txtsize_s = NULL;
-static char *govl_font_s = NULL;
-static char *govl_txttrans_s = NULL;
+static char* govl_txtcol_s = NULL;
+static char* govl_txtsize_s = NULL;
+static char* govl_font_s = NULL;
+static char* govl_txttrans_s = NULL;
-static char *govl_file_s = NULL;
+static char* govl_file_s = NULL;
static arglist_t ovl_args[] = {
{
};
-static char *Keywords[]= {
+static char* Keywords[]= {
"Typ",
"Group",
"Col",
#define KEY_TRANS 14
#define KEY_TRANSBYTE 15
-static int isKeyword(char *str,char **keys)
+static int isKeyword(char* str,char** keys)
{
int i;
/*----------------------------------------------*/
static
-void ovl_rd_init(char const *fname)
+void ovl_rd_init(char const* fname)
{
fpin = gbfopen(fname, "r", MYNAME);
}
static struct _group {
int group;
- char *name;
-} *groups;
+ char* name;
+}* groups;
static int groups_cnt;
-static void ovl_add_group(int aktgrp,char *akttxt)
+static void ovl_add_group(int aktgrp,char* akttxt)
{
int i;
i++;
}
if (i==groups_cnt) {
- groups = (struct _group *) xrealloc(groups,(groups_cnt+1)*sizeof(struct _group));
+ groups = (struct _group*) xrealloc(groups,(groups_cnt+1)*sizeof(struct _group));
groups[i].group = aktgrp;
groups[i].name = NULL;
groups_cnt++;
}
- groups[i].name = (char *) xrealloc(groups[i].name,(strlen(akttxt)+1)*sizeof(char));
+ groups[i].name = (char*) xrealloc(groups[i].name,(strlen(akttxt)+1)*sizeof(char));
strcpy(groups[i].name,akttxt);
}
/*
The name of route is stored in a 'Text'-symbol with identical 'Group'-number.
*/
-static void route_add_name(const route_head *hd)
+static void route_add_name(const route_head* hd)
{
int grp;
int i;
char name[MAXLINE];
- route_head *route;
+ route_head* route;
- route = (route_head *) hd;
+ route = (route_head*) hd;
grp = atoi(route->rte_name);
i = 0;
while (i<groups_cnt && groups[i].group!=grp) {
} else {
strcpy(name,groups[i].name);
}
- route->rte_name = (char *) xrealloc(route->rte_name,(strlen(name)+1)*sizeof(char));
+ route->rte_name = (char*) xrealloc(route->rte_name,(strlen(name)+1)*sizeof(char));
strcpy(route->rte_name,name);
}
static void ovl_read(void)
{
- char *line;
+ char* line;
int isSection;
int aktTyp,aktCol,aktSize,aktArt,aktGroup;
int aktArea,aktWidth,aktHeight,aktTrans,aktTransByte,aktDir;
double aktX,aktY;
- char *aktPath;
- char *aktText;
- char *pstr;
+ char* aktPath;
+ char* aktText;
+ char* pstr;
int keyw,i;
double rwert;
- route_head *route_head = NULL;
- waypoint *wpt;
+ route_head* route_head = NULL;
+ waypoint* wpt;
int sym_cnt;
int lineno = 0;
}
/*------------------------------------------*/
-void ovl_read_parameter(char *fname)
+void ovl_read_parameter(char* fname)
{
- gbfile *fpin;
- arglist_t *p;
- char *str;
- char *pstr;
+ gbfile* fpin;
+ arglist_t* p;
+ char* str;
+ char* pstr;
fpin = gbfopen(fname, "r", MYNAME);
if (fpin!=NULL) {
}
}
-static void ovl_wr_init(const char *fname)
+static void ovl_wr_init(const char* fname)
{
fpout = gbfopen(fname, "w", MYNAME);
govl_sum_n = 0.0;
gbfclose(fpout);
}
-static void symbol_init(const route_head *hd)
+static void symbol_init(const route_head* hd)
{
gbfprintf(fpout,"[Symbol %d]\n",govl_symbol_cnt+1);
gbfprintf(fpout,"Typ=3\n"); // Linie
govl_group_cnt++;
}
-static void symbol_text(double east,double north,char *text,int group)
+static void symbol_text(double east,double north,char* text,int group)
{
gbfprintf(fpout,"[Symbol %d]\n",govl_symbol_cnt+1);
gbfprintf(fpout,"Typ=2\n"); // Text
govl_symbol_cnt++;
}
-static void symbol_point(const waypoint *wpt)
+static void symbol_point(const waypoint* wpt)
{
double east,north;
}
-static void symbol_deinit(const route_head *hd)
+static void symbol_deinit(const route_head* hd)
{
- queue *elem, *tmp;
- waypoint *waypointp;
+ queue* elem, *tmp;
+ waypoint* waypointp;
int i;
double lat1,lon1,lat2,lon2;
double lats,lons,late,lone;
dist = 0.0;
i = 0;
QUEUE_FOR_EACH(&(hd->waypoint_list), elem, tmp) {
- waypointp = (waypoint *) elem;
+ waypointp = (waypoint*) elem;
lat2 = RAD(waypointp->latitude);
lon2 = RAD(waypointp->longitude);
if (i) {
i = 0;
elem = QUEUE_FIRST(&(hd->waypoint_list));
while (elem!=&(hd->waypoint_list) && dd<dist/2.0) {
- waypointp = (waypoint *) elem;
+ waypointp = (waypoint*) elem;
lat2 = RAD(waypointp->latitude);
lon2 = RAD(waypointp->longitude);
if (i) {
govl_dir = 0.0; // restore
}
-static void overlay_waypt_pr(const waypoint *waypointp)
+static void overlay_waypt_pr(const waypoint* waypointp)
{
- const char *oname;
- char *odesc;
+ const char* oname;
+ char* odesc;
/*
* Desparation time, try very hard to get a good shortname
ozi_copy_fsdata(ozi_fsdata **dest, ozi_fsdata *src)
{
/* No strings to mess with. Straight forward copy. */
- *dest = (void *)xmalloc(sizeof(*src));
+ *dest = (ozi_fsdata *)xmalloc(sizeof(*src));
**dest = *src;
(*dest)->fs.next = NULL;
}
ozi_fsdata *
ozi_alloc_fsdata(void)
{
- ozi_fsdata *fsdata = xcalloc(sizeof(*fsdata), 1);
+ ozi_fsdata *fsdata = (ozi_fsdata*) xcalloc(sizeof(*fsdata), 1);
fsdata->fs.type = FS_OZI;
fsdata->fs.copy = (fs_copy) ozi_copy_fsdata;
fsdata->fs.destroy = ozi_free_fsdata;
gbuint32 id;
gbuint8 category;
gbuint8 flags;
- char *data;
- struct pdbrec_s *next;
+ char* data;
+ struct pdbrec_s* next;
} pdbrec_t;
typedef struct {
- gbfile *file;
+ gbfile* file;
char mode; /* file-mode: 1 = read / 2 = write */
char name[PDB_DBNAMELEN + 1]; /* database name */
gbuint16 attr; /* attributes */
gbuint32 type;
gbuint32 uid;
gbuint16 rec_ct;
- struct pdbrec_s *rec_list;
- struct pdbrec_s *rec_curr;
- void *appinfo;
+ struct pdbrec_s* rec_list;
+ struct pdbrec_s* rec_curr;
+ void* appinfo;
int appinfo_len;
} pdbfile;
-pdbfile *pdb_open(const char *filename, const char *module);
-pdbfile *pdb_create(const char *filename, const char *module);
-void pdb_close(pdbfile *file);
-int pdb_eof(pdbfile *fin);
-void pdb_rewind(pdbfile *fin);
-int pdb_read_rec(pdbfile *fin, gbuint8 *flags, gbuint8 *category, gbuint32 *rec_id, void **data);
-int pdb_read_rec_by_id(pdbfile *fin, const gbuint32 rec_id, gbuint8 *flags, gbuint8 *category, void **data);
-void pdb_write_rec(pdbfile *fout, const gbuint8 flags, const gbuint8 category, const gbuint32 rec_id, const void *data, const gbuint32 size);
+pdbfile* pdb_open(const char* filename, const char* module);
+pdbfile* pdb_create(const char* filename, const char* module);
+void pdb_close(pdbfile* file);
+int pdb_eof(pdbfile* fin);
+void pdb_rewind(pdbfile* fin);
+int pdb_read_rec(pdbfile* fin, gbuint8* flags, gbuint8* category, gbuint32* rec_id, void** data);
+int pdb_read_rec_by_id(pdbfile* fin, const gbuint32 rec_id, gbuint8* flags, gbuint8* category, void** data);
+void pdb_write_rec(pdbfile* fout, const gbuint8 flags, const gbuint8 category, const gbuint32 rec_id, const void* data, const gbuint32 size);
#endif
#endif
wpt->pdop = le_read_float(&bc.espe);
wpt->course = le_read_float(&bc.course);
wpt->speed = le_read_float(&bc.speed);
- wpt->fix = le_readu16(&bc.fix) - 1;
+ wpt->fix = (fix_type) le_readu16(&bc.fix) - 1;
track_add_wpt(trk_head, wpt);
}
ff_type_file,
{
ff_cap_none, /* waypoints */
- ff_cap_read | ff_cap_write, /* tracks */
+ (ff_cap)(ff_cap_read | ff_cap_write), /* tracks */
ff_cap_none /* routes */
},
rd_init,
{ wpt_to_elev, cb_cdata, "/PocketFMSFlightplan/LIB/ToPoint/Elevation" },
{ wpt_altitude, cb_start, "/PocketFMSFlightplan/LIB/PlannedAltitude" },
{ wpt_e, cb_end, "/PocketFMSFlightplan/LIB" },
- { NULL, 0, NULL}
+ { NULL, (xg_cb_type)0, NULL}
};
static void
ff_vecs_t pocketfms_wp_vecs = {
ff_type_file,
{
- ff_cap_read | ff_cap_write, /* waypoints */
+ (ff_cap)(ff_cap_read | ff_cap_write), /* waypoints */
ff_cap_none, /* tracks */
ff_cap_none, /* routes */
},
*/
typedef struct queue {
- struct queue *next;
- struct queue *prev;
+ struct queue* next;
+ struct queue* prev;
} queue;
-void enqueue(queue *new_el, queue *old);
-queue * dequeue(queue *element);
+void enqueue(queue* new_el, queue* old);
+queue* dequeue(queue* element);
-void sortqueue(queue *qh, int (*cmp)(const queue *, const queue *));
+void sortqueue(queue* qh, int (*cmp)(const queue*, const queue*));
#define QUEUE_INIT(head) (head)->next = ((head)->prev = head)
#define QUEUE_FIRST(head) ((head)->next)
len = rand_int(maxlen) + 1;
- res = xmalloc(len + 1);
+ res = (char*) xmalloc(len + 1);
res[len] = '\0';
for (i = 0; i < len; i++) {
wpt->hdop = (rand_int(500)) / 10.0;
wpt->vdop = (rand_int(500)) / 10.0;
wpt->pdop = (rand_int(500)) / 10.0;
- wpt->fix = rand_int(6) - 1;
+ wpt->fix = (fix_type)(rand_int(6) - 1);
if RND(3) {
wpt->cadence = rand_int(255);
}
if (waypt_table_ct >= waypt_table_sz) {
waypt_table_sz += 32;
if (waypt_table) {
- waypt_table = (void *) xrealloc(waypt_table, waypt_table_sz * sizeof(wpt));
+ waypt_table = (waypoint**) xrealloc(waypt_table, waypt_table_sz * sizeof(wpt));
} else {
- waypt_table = (void *) xmalloc(waypt_table_sz * sizeof(wpt));
+ waypt_table = (waypoint**) xmalloc(waypt_table_sz * sizeof(wpt));
}
}
ff_vecs_t raymarine_vecs = {
ff_type_file,
{
- ff_cap_read | ff_cap_write /* waypoints */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */,
ff_cap_none /* tracks */,
- ff_cap_read | ff_cap_write /* routes */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* routes */,
},
raymarine_rd_init,
raymarine_wr_init,
addrlen = le_read16(&record[obase]);
cmtlen = le_read16(&record[obase+2+addrlen]);
- wpt_tmp->shortname = xmalloc(addrlen+1);
+ wpt_tmp->shortname = (char*) xmalloc(addrlen+1);
wpt_tmp->shortname[addrlen]='\0';
- wpt_tmp->notes = xmalloc(cmtlen+1);
+ wpt_tmp->notes = (char *) xmalloc(cmtlen+1);
wpt_tmp->notes[cmtlen] = '\0';
memcpy(wpt_tmp->notes,
record+obase+4+addrlen,
record+obase+2,
addrlen);
} else {
- wpt_tmp->shortname = xmalloc(7);
+ wpt_tmp->shortname = (char*) xmalloc(7);
sprintf(wpt_tmp->shortname, "\\%5.5x", serial++);
}
if (control == 2) {
wpt_tmp->latitude = lat;
wpt_tmp->longitude = -lon;
if (stringlen && ((coordcount>1) || count)) {
- wpt_tmp->shortname = xmalloc(stringlen+1);
+ wpt_tmp->shortname = (char *) xmalloc(stringlen+1);
wpt_tmp->shortname[stringlen] = '\0';
memcpy(wpt_tmp->shortname,
((char *)record)+2,
data_size = size + 4;
/* data_size can be up to about 64k */
- data = xmalloc(data_size);
+ data = (unsigned char *) xmalloc(data_size);
if (gbfread(data, data_size, 1, file_handle) != 1) {
fatal(MYNAME ": Format error: could not read %d bytes.\n",
typedef struct {
queue Q;
int id;
- char *name;
+ char* name;
} category_t;
typedef struct {
queue Q;
int nr;
- const char *name; /* in normal case the name of a format */
- char *filename; /* used file within format */
+ const char* name; /* in normal case the name of a format */
+ char* filename; /* used file within format */
int category_ct;
int unknown_category_ct; /* added without id */
queue category_list;
void session_init(void);
void session_exit(void);
-void start_session(const char *name, const char *filename);
-session_t *curr_session(void);
+void start_session(const char* name, const char* filename);
+session_t* curr_session(void);
/* in work
int session_add_category(const char *name, const int id);
}
}
- buffer = xmalloc(SECTOR_SIZE*read_at_once+sizeof(SECTOR_READ_END)+6);
+ buffer = (gbuint8*) xmalloc(SECTOR_SIZE*read_at_once+sizeof(SECTOR_READ_END)+6);
// m.ad/090930: removed code that tried reducing read_at_once if necessary since doesn't work with xmalloc
if (opt_dump_file) {
gbuint8 *buffer;
state_init(&st);
- buffer = xmalloc(SECTOR_SIZE);
+ buffer = (gbuint8*) xmalloc(SECTOR_SIZE);
if (opt_first_sector_val > 0) {
db(4, MYNAME ": Seeking to first-sector index %i\n", opt_first_sector_val*SECTOR_SIZE);
/*
* Version of "strptime()", for the benefit of OSes that don't have it.
*/
-extern char *strptime(const char *, const char *, struct tm *);
+extern char* strptime(const char*, const char*, struct tm*);
#endif
{ tef_point, cb_start, "/TEF/WaypointList/Item/Point" },
{ tef_item_end, cb_end, "/TEF/WaypointList/Item" },
{ tef_list_end, cb_end, "/TEF/WaypointList" },
- { NULL, 0, NULL }
+ { NULL, (xg_cb_type)0, NULL }
};
if (1) { // need bit value of NEWFORMAT
int len = gbfgetuint16(fin);
// probably could treat as a pascal string
- char *junk = xmalloc(len);
+ char *junk = (char*) xmalloc(len);
gbfread(junk, len, 1, fin);
xfree(junk);
}
ff_vecs_t teletype_vecs = {
ff_type_file,
{
- ff_cap_read | ff_cap_write /* waypoints */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */,
ff_cap_none /* tracks */,
ff_cap_none /* routes */
},
char *
decode_8(int sz, const unsigned char *inbuf)
{
- static const char encoding_8[32] = "X. SaerionstldchumgpbkfzvACBMPG-";
+ static const char encoding_8[] = "X. SaerionstldchumgpbkfzvACBMPG-";
static const int encoding_8_high[8] = {0x2,0x3,0x4,0x5,0x6,0x7,0xe,0xf};
// Maximally sized for laziness.
- char *rval = xmalloc(sz * 3 + 1);
+ char *rval = (char *) xmalloc(sz * 3 + 1);
char *out = rval;
int i;
int
compare_lat(const void *a, const void *b)
{
- const struct hdr *wa = a;
- const struct hdr *wb = b;
+ const struct hdr *wa = (const struct hdr*) a;
+ const struct hdr *wb = (const struct hdr*) b;
double difference = wa->wpt->latitude - wb->wpt->latitude;
if (difference < 0) {
int
compare_lon(const void *a, const void *b)
{
- const struct hdr *wa = a;
- const struct hdr *wb = b;
+ const struct hdr *wa = (const struct hdr*)a;
+ const struct hdr *wb = (const struct hdr*)b;
double difference = wa->wpt->longitude - wb->wpt->longitude;
if (difference < 0) {
double maxlat = -200;
struct blockheader *blocks = NULL;
- htable = xmalloc(ct * sizeof(*htable));
+ htable = (struct hdr*) xmalloc(ct * sizeof(*htable));
bh = htable;
QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
/* read the id string */
gbfread(&string_size, 1, 1, tpo_file_in);
- string_buffer = xmalloc(string_size+1);
+ string_buffer = (char *) xmalloc(string_size+1);
gbfread(string_buffer, 1, string_size, tpo_file_in);
/* terminate the string */
tpo_dump_header_bytes(int header_size)
{
int i;
- unsigned char* buffer = (unsigned char*)xmalloc(header_size);
+ unsigned char* buffer = (unsigned char*)(char *) xmalloc(header_size);
gbfread(buffer, 1, header_size, tpo_file_in);
waypoint_count = gbfgetint16(tpo_file_in);
/* allocate temporary memory for the waypoint deltas */
- lon_delta = (short*)xmalloc(waypoint_count * sizeof(short));
- lat_delta = (short*)xmalloc(waypoint_count * sizeof(short));
+ lon_delta = (short*)(char *) xmalloc(waypoint_count * sizeof(short));
+ lat_delta = (short*)(char *) xmalloc(waypoint_count * sizeof(short));
for (j=0; j<waypoint_count; j++) {
name_length = tpo_read_int();
if (name_length) {
- track_name = xmalloc(name_length+1);
+ track_name = (char *) xmalloc(name_length+1);
track_name[0] = '\0';
gbfread(track_name, 1, name_length, tpo_file_in);
track_name[name_length] = '\0'; // Terminator
} else { // Assign a generic track name
- track_name = xmalloc(15);
+ track_name = (char *) xmalloc(15);
sprintf(track_name, "TRK %d", ii+1);
}
track_temp->rte_name = track_name;
// proper place for the next track.
// Read the track bytes into a buffer
- buf = xmalloc(track_byte_count);
+ buf = (unsigned char *) xmalloc(track_byte_count);
gbfread(buf, 1, track_byte_count, tpo_file_in);
latscale=0;
// Fetch storage for the waypoint index (needed later for
// routes)
- tpo_wp_index = (waypoint **)xmalloc(sizeof(waypoint *) * waypoint_count);
+ tpo_wp_index = (waypoint **)(char *) xmalloc(sizeof(waypoint *) * waypoint_count);
if (waypoint_count == 0) {
return;
name_length = tpo_read_int();
//printf("\nName Length: %d\n", name_length);
if (name_length) {
- waypoint_name = xmalloc(name_length+1);
+ waypoint_name = (char *) xmalloc(name_length+1);
waypoint_name[0] = '\0';
gbfread(waypoint_name, 1, name_length, tpo_file_in);
waypoint_name[name_length] = '\0'; // Terminator
} else { // Assign a generic waypoint name
- waypoint_name = xmalloc(15);
+ waypoint_name = (char *) xmalloc(15);
sprintf(waypoint_name, "WPT %d", ii+1);
}
//printf("\tWaypoint Name: %s\n", waypoint_name);
if (name_length) {
char *comment;
- comment = xmalloc(name_length+1);
+ comment = (char *) xmalloc(name_length+1);
comment[0] = '\0';
gbfread(comment, 1, name_length, tpo_file_in);
comment[name_length] = '\0'; // Terminator
waypoint_temp = tpo_convert_ll(lat, lon);
// Assign a generic waypoint name
- waypoint_name = xmalloc(15);
+ waypoint_name = (char *) xmalloc(15);
sprintf(waypoint_name, "NOTE %d", ii+1);
//printf("Waypoint Name: %s\t\t", waypoint_name);
waypoint_temp->shortname = waypoint_name;
if (name_length) {
char *comment;
- comment = xmalloc(name_length+1);
+ comment = (char *) xmalloc(name_length+1);
comment[0] = '\0';
gbfread(comment, 1, name_length, tpo_file_in);
comment[name_length] = '\0'; // Terminator
if (name_length) {
char *notes;
- notes = xmalloc(name_length+1);
+ notes = (char *) xmalloc(name_length+1);
notes[0] = '\0';
gbfread(notes, 1, name_length, tpo_file_in);
notes[name_length] = '\0'; // Terminator
if (name_length) {
char *notes;
- notes = xmalloc(name_length+1);
+ notes = (char *) xmalloc(name_length+1);
notes[0] = '\0';
gbfread(notes, 1, name_length, tpo_file_in);
notes[name_length] = '\0'; // Terminator
waypoint_temp = tpo_convert_ll(lat, lon);
// Assign a generic waypoint name
- waypoint_name = xmalloc(15);
+ waypoint_name = (char *) xmalloc(15);
sprintf(waypoint_name, "SYM %d", ii+1);
//printf("Waypoint Name: %s\n", waypoint_name);
waypoint_temp->shortname = waypoint_name;
waypoint_temp = tpo_convert_ll(lat, lon);
// Assign a generic waypoint name
- waypoint_name = xmalloc(15);
+ waypoint_name = (char *) xmalloc(15);
sprintf(waypoint_name, "TXT %d", ii+1);
//printf("Waypoint Name: %s\t\t", waypoint_name);
waypoint_temp->shortname = waypoint_name;
if (name_length) {
char *comment;
- comment = xmalloc(name_length+1);
+ comment = (char *) xmalloc(name_length+1);
comment[0] = '\0';
gbfread(comment, 1, name_length, tpo_file_in);
comment[name_length] = '\0'; // Terminator
// Fetch name length
name_length = tpo_read_int();
if (name_length) {
- route_name = xmalloc(name_length+1);
+ route_name = (char *) xmalloc(name_length+1);
route_name[0] = '\0';
gbfread(route_name, 1, name_length, tpo_file_in);
route_name[name_length] = '\0'; // Terminator
} else { // Assign a generic route name
- route_name = xmalloc(15);
+ route_name = (char *) xmalloc(15);
sprintf(route_name, "RTE %d", ii+1);
}
route_temp->rte_name = route_name;
ff_vecs_t tpo2_vecs = {
ff_type_file, /* ff_type_internal */
/* { ff_cap_none | ff_cap_none, ff_cap_read | ff_cap_write, ff_cap_none | ff_cap_none }, */
- { ff_cap_none | ff_cap_none, ff_cap_read, ff_cap_none | ff_cap_none },
+ { ff_cap_none, ff_cap_read, ff_cap_none },
tpo_rd_init,
tpo_wr_init,
tpo_rd_deinit,
ff_type_file,
{
ff_cap_none /* waypoints */,
- ff_cap_read | ff_cap_write /* tracks */,
+ (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */,
ff_cap_none /* routes */
},
vidaone_rd_init,
static void
WriteDouble(void* ptr, double d)
{
- unsigned char result[8]="\0\0\0\0\0\0\0\0";
+ unsigned char result[9]="\0\0\0\0\0\0\0\0";
le_write_double(result,d);
memcpy(ptr, result, 8);
}
wpt_tmp->creation_time = mkgmtime(&tmStruct);
wpt_tmp->microseconds = fmod(1000000*seconds+0.5,1000000);
- wpt_tmp->shortname =xcalloc(16,1);
+ wpt_tmp->shortname = (char*) xcalloc(16,1);
snprintf(wpt_tmp->shortname, 15 , "WP%04d", ++serial);
WAYPT_SET(wpt_tmp, speed, KNOTS_TO_MPS(speed)); /* meters per second */
double seconds =0;
++count;
- workbuffer = xcalloc(vitosmt_datasize,1);
+ workbuffer = (unsigned char *) xcalloc(vitosmt_datasize,1);
WriteDouble(&workbuffer[position], RAD(waypointp->latitude));
position += sizeof(double);
unsigned char * workbuffer =0;
size_t position =0;
- workbuffer = xcalloc(vitosmt_headersize,1);
+ workbuffer = (unsigned char*) xcalloc(vitosmt_headersize,1);
now = current_time();
count = 0;
};
struct read_state {
- route_head *route_head;
+ route_head *route_head_;
unsigned wpn, tpn;
struct buf_head data;
*/
static int do_cmd(const char *cmd, const char *expect, char *buf, int len)
{
- int try;
+ int trycount;
rd_drain();
wr_cmdl(cmd);
* NMEA data all the time so it's highly likely that it'll be in the
* middle of an NMEA sentence when we start listening.
*/
- for (try = 0; try < RETRIES; try++) {
- rd_line(buf, len);
- db(3, "Got: %s\n", buf);
- if (starts_with(buf, expect)) {
- db(2, "Matched: %s\n", buf);
- return strlen(expect);
- }
- db(2, "Skip %d: %s\n", try, buf);
- }
+ for (trycount = 0; trycount < RETRIES; trycount++) {
+ rd_line(buf, len);
+ db(3, "Got: %s\n", buf);
+ if (starts_with(buf, expect)) {
+ db(2, "Matched: %s\n", buf);
+ return strlen(expect);
+ }
+ db(2, "Skip %d: %s\n", trycount, buf);
+ }
fatal(MYNAME ": Bad response from unit\n");
return 0; /* keep compiler quiet */
double lat, lon, alt;
time_t rtim;
waypoint *tpt = NULL;
- const char *bp = buf;
+ const char *bp = (const char*) buf;
size_t buf_used = fmt_version[fmt].reclen;
tim = le_read32(bp + 0);
if (lat >= 100) {
/* Start new track in the northern hemisphere */
lat -= 100;
- st->route_head = NULL;
+ st->route_head_ = NULL;
} else if (lat <= -100) {
/* Start new track in the southern hemisphere */
/* This fix courtesy of Anton Frolich */
lat += 100;
- st->route_head = NULL;
+ st->route_head_ = NULL;
}
tpt = make_trackpoint(st, lat, lon, alt, rtim);
- if (NULL == st->route_head) {
+ if (NULL == st->route_head_) {
db(1, "New Track\n");
- st->route_head = route_head_alloc();
- track_add_head(st->route_head);
+ st->route_head_ = route_head_alloc();
+ track_add_head(st->route_head_);
}
- track_add_wpt(st->route_head, tpt);
+ track_add_wpt(st->route_head_, tpt);
return 1;
}
static void state_init(struct read_state *pst)
{
- pst->route_head = NULL;
+ pst->route_head_ = NULL;
pst->wpn = 0;
pst->tpn = 0;
static int all_null(const void *buf, const int len)
{
- const char *bp = buf;
+ const char *bp = (const char *) buf;
int i;
for (i = 0; i < len; i++) {
double lat, lon, alt;
time_t rtim;
waypoint *tpt = NULL;
- const char *bp = buf;
+ const char *bp = (const char *) buf;
/* Zero records are skipped */
if (all_null(buf, RECLEN_WBT201)) {
if (global_opts.masked_objective & TRKDATAMASK) {
if (flags & WBT201_TRACK_START) {
- st->route_head = NULL;
+ st->route_head_ = NULL;
}
tpt = make_trackpoint(st, lat, lon, alt, rtim);
- if (NULL == st->route_head) {
+ if (NULL == st->route_head_) {
db(1, "New Track\n");
- st->route_head = route_head_alloc();
- track_add_head(st->route_head);
+ st->route_head_ = route_head_alloc();
+ track_add_head(st->route_head_);
}
- track_add_wpt(st->route_head, tpt);
+ track_add_wpt(st->route_head_, tpt);
}
return 1;
{ wfff_hdop, cb_cdata, "/DocumentElement/AP/HDOP" },
{ wfff_lat, cb_cdata, "/DocumentElement/AP/Lat" },
{ wfff_lon, cb_cdata, "/DocumentElement/AP/Lon" },
- { 0,0,0 }
+ { 0,(xg_cb_type)0,0 }
};
/* work variables for wfff_xxx */
cb_end,
} xg_cb_type;
-typedef void (xg_callback)(const char *, const char **);
+typedef void (xg_callback)(const char*, const char**);
typedef struct xg_tag_mapping {
- xg_callback *tag_cb;
+ xg_callback* tag_cb;
xg_cb_type cb_type;
- const char *tag_name;
+ const char* tag_name;
} xg_tag_mapping;
-extern char *xhtml_entities;
+extern char* xhtml_entities;
-void write_xml_entity(gbfile *ofd, const char *indent,
- const char *tag, const char *value);
-void write_xml_entity_begin0(gbfile *ofd, const char *indent,
- const char *tag);
-void write_xml_entity_begin1(gbfile *ofd, const char *indent, const char *tag,
- const char *attr1, const char *attrval1);
-void write_xml_entity_begin2(gbfile *ofd, const char *indent, const char *tag,
- const char *attr1, const char *attrval1,
- const char *attr2, const char *attrval2);
-void write_xml_entity_end(gbfile *ofd, const char *indent, const char *tag);
+void write_xml_entity(gbfile* ofd, const char* indent,
+ const char* tag, const char* value);
+void write_xml_entity_begin0(gbfile* ofd, const char* indent,
+ const char* tag);
+void write_xml_entity_begin1(gbfile* ofd, const char* indent, const char* tag,
+ const char* attr1, const char* attrval1);
+void write_xml_entity_begin2(gbfile* ofd, const char* indent, const char* tag,
+ const char* attr1, const char* attrval1,
+ const char* attr2, const char* attrval2);
+void write_xml_entity_end(gbfile* ofd, const char* indent, const char* tag);
-void write_optional_xml_entity(gbfile *ofd, const char *indent,
- const char *tag, const char *value);
-void xml_write_time(gbfile *ofd, const time_t timep, int microseconds, const char *elname);
-void xml_fill_in_time(char *time_string, const time_t timep, int microseconds,
+void write_optional_xml_entity(gbfile* ofd, const char* indent,
+ const char* tag, const char* value);
+void xml_write_time(gbfile* ofd, const time_t timep, int microseconds, const char* elname);
+void xml_fill_in_time(char* time_string, const time_t timep, int microseconds,
int long_or_short);
-void write_xml_header(gbfile *ofd);
-void xml_ignore_tags(const char **taglist);
+void write_xml_header(gbfile* ofd);
+void xml_ignore_tags(const char** taglist);
-void xml_init(const char *fname, xg_tag_mapping *tbl,const char *encoding);
-void xml_init_offset(const char *fname, xg_tag_mapping *tbl,
- const char *encoding, gbsize_t offset);
+void xml_init(const char* fname, xg_tag_mapping* tbl,const char* encoding);
+void xml_init_offset(const char* fname, xg_tag_mapping* tbl,
+ const char* encoding, gbsize_t offset);
void xml_read(void);
-void xml_readstring(char *str);
-void xml_readprefixstring(char *str);
+void xml_readstring(char* str);
+void xml_readprefixstring(char* str);
void xml_deinit(void);
{ xol_shape, cb_start, XOL "/shapes/*shape" },
{ xol_shape_end, cb_end, XOL "/shapes/*shape" },
{ xol_waypt, cb_start, XOL "/shapes/shape/*points/point" },
- { NULL, 0, NULL }
+ { NULL, (xg_cb_type)0, NULL }
};
ff_vecs_t xol_vecs = {
ff_type_file,
{
- ff_cap_read | ff_cap_write, /* waypoints */
- ff_cap_read | ff_cap_write, /* tracks */
+ (ff_cap)(ff_cap_read | ff_cap_write), /* waypoints */
+ (ff_cap)(ff_cap_read | ff_cap_write), /* tracks */
ff_cap_none
}, /* routes */
xol_rd_init,
{ wpt_addr, cb_cdata, "/ResultSet/Result/Zip" },
{ wpt_addr, cb_cdata, "/ResultSet/Result/Country" },
{ wpt_e, cb_end, "/ResultSet/Result" },
- { NULL, 0, NULL}
+ { NULL, (xg_cb_type)0, NULL}
};
static void